Why doesn't my processor have built-in BigInt support?

后端 未结 8 1965
执笔经年
执笔经年 2021-02-20 13:20

As far as I understood it, BigInts are usually implemented in most programming languages as arrays containing digits, where, eg.: when adding two of them, each digit is added on

8条回答
  •  后悔当初
    2021-02-20 13:53

    Suppose the result of the multiplication needed 3 times the space (memory) to be stored - where would the processor store that result ? How would users of that result, including all pointers to it know that its size suddenly changed - and changing the size might need it to relocate it in memory cause extending the current location would clash with another variable.

    This would create a lot of interaction between the processor, OS memory managment, and the compiler that would be hard to make both general and efficient.

    Managing the memory of application types is not something the processor should do.

提交回复
热议问题