3 ms·
… why is there an i31 type in that proposal?
by deathanatos 5y ago
… why is there an i31 type in that proposal?
- djur 5y ago"31 bits... is the widest range that can be guaranteed to be efficiently representable on all platforms." This is because JS numbers are encoded as double floats, and the most efficient representation of an integer in v8 is a "SMI (small integer)", a 31-bit signed integer: https://medium.com/fhinkel/v8-internals-how-small-is-a-small-integer-e0badc18b6da https://medium.com/fhinkel/v8-internals-how-small-is-a-small...
- progval 5y agoI don't know about this proposal in particular, but it is common for garbage-collected languages to use the highest bit to distinguish pointers and integers; which means integers cannot use it.