How does a 32-bit computer with large bit numbers work? Ex. 512-bit integers

I read an article on cryptography, and I thought: "How does a 32-bit computer really perform operations with a 512-bit value or even with a 64-bit value?"

Can anyone point me in the right direction? Maybe I do not understand how to correctly express what I want to know, but Google searches did not help much in this.

Thanks!

+2
source share
5 answers

This is an extension of GregS comment .

Suppose I know all 100 single-digit * single-digit multiplications (from 0 * 0 = 0 to 9 * 9 = 81 ), and someone asks me to calculate 561 * 845 . I could say: "Sorry, I can’t multiply numbers, big"; or, I could remember my childhood and do this:

  561 845 * ---------- 2805 2244 4488 + ========== 474045 

which requires only what I can do at any given step, multiplication within my known range or addition (with carry).

Now suppose that instead of decimal digits, each of the above characters was instead a 32-bit word; and instead of me, we had a processor that can multiply 32-bit words by a 64-bit result and add (wrap) 32-bit words. Voila, we have a system for performing arbitrarily large binary multiplications.

+5
source

32 bits at a time. Flags exist to indicate carry, overflow, etc., to allow verbose arithmetic through repeated operations.

+3
source

A 32-bit processor can break large numbers into more than one register, although it is slower than performing operations in a single 32-bit register. For addition / subtraction, it simply performs arithmetic, starting with the least significant register, and then transfers the status bit to the next significant register. This can get a little more complicated with multiplication / division, but the main disadvantage is performance.

See http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic for more details.

Also this question: How do programming languages ​​handle the huge arithmetic of numbers

+2
source

Operations are performed in software or specialized hardware is used (for encryption). For example, libraries, see GMP and MPFR .

0
source

In a walnut shell that Mitch said where she just smashes it in half. It may take some time for your processor to process it, but that is why we now have multi-core processors to speed up this process. That is why most OSs come in 32-bit and 64-bit versions, and ultimately 128. If you are interested, take a few classes in assemblies and machine languages

0
source

Source: https://habr.com/ru/post/945854/


All Articles