long long implementation in 32 bit machine

后端 未结 5 493
渐次进展
渐次进展 2020-12-03 10:41

As per c99 standard, size of long long should be minimum 64 bits. How is this implemented in a 32 bit machine (eg. addition or multiplication of 2 long lo

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 11:28

    As everyone has stated, a 64-bit integer is typically implemented by simply using two 32-bit integers together. Then clever code generation is used to keep track of the carry and/or borrow bits to keep track of overflow, and adjust accordingly.

    This of course makes such arithmetic more costly in terms of code space and execution time, than the same code compiled for an architecture with native support for 64-bit operations.

提交回复
热议问题