x86-64 Big Integer Representation?

后端 未结 2 1898
失恋的感觉
失恋的感觉 2020-12-11 10:18

How do hig-performance native big-integer libraries on x86-64 represent a big integer in memory? (or does it vary? Is there a most common way?)

Naively I was think

2条回答
  •  独厮守ぢ
    2020-12-11 10:43

    I would think it would be as an array lowest value to highest. I implemented addition of arbitrary sized numbers in assembler. The CPU provides the carry flag that allows you to easily perform these sorts of operations. You write a loop that performs the operation in byte size chunks. The carry flag is included in the next operation using the "Add with carry" instruction (ADC opcode).

提交回复
热议问题