Operations on 64-bit operands in 32-bit architectures?

How do most compilers implement operations on 64-bit operands (for example, long int) in 32-bit environments? in other words, is there a way to implement these operations in one step, or do we need to access several memory cells to implement these operations?

+5
source share
1 answer

They use two registers to store a 64-bit value. One for the lower 32-bit and one for the upper 32-bit.

For x86, 64-bit addition / subtraction is done using the add-with-carry and subtract-with-loan commands:

add   %eax, (lower 32-bits of operand)
adc   %edx, (upper 32-bits of operand)

64- , 32- 32- -. ( 2 )

, 32- / / .

, 128- 64- . GCC .

+5

All Articles