Elektrine lite

← Feed

@kenshirriff@oldbytes.space

2025-03-02 18:31 UTC

To multiply by 3 in binary, you can add the number to 2 times the number (a quick shift). Unfortunately, adding two 64-bit numbers is slow because of carries. (Just like 999999+1: you need to keep doing carry-the-one.) To make this addition fast, the Pentium uses complicated adder circuitry. 4/N

Replies (4)

  • @kenshirriff@oldbytes.space 2025-03-02 18:32

    The Pentium's adder uses a combination of techniques: carry-lookahead, carry-save addition, and Kogge-Stone. I won't go into details here but essentially all the carry bits are computed in parallel, so then the addition can happen in parallel. The photo shows one of the 8-bit addition blocks. 5/N

    Open ##1442794

  • @paco@infosec.exchange 2025-03-02 18:40

    @kenshirriff Years ago I saw a biology internship advertised on “Taxonomy of Spider Genitalia”. The tag line was “we know they do it, but we don’t know how.” Apparently multiplying by 3 is similar: i knew they did it, but I didn’t know how.

    Open ##1442839

  • @Flux@wandering.shop 2025-03-02 18:57

    @kenshirriff why not do it like seven? Multiply by four and subtract one? Or perhaps, why does 7 not suffer from the same problem as 3? Is 3 just used enough more frequently? Edit: and answered down thread. Excellent work! Thanks.

    Open ##1442842

  • @http@infosec.exchange 2025-03-02 19:34

    @kenshirriff Adding two integers is slow, but multiply by 8 and subtracting 2x is fast? Why is subtraction faster than addition?

    Open ##1442843