This was once submitted as a [BUG] and with no [FIX].
The class comment in SmallInteger states:
My instances are 30-bit numbers, stored in twos complement form. The allowable range is approximately +- 1 billion (see SmallInteger minVal, maxVal).
which is wrong. The virtual machine uses a one bit tag to indicate that the rest of the 32 bit object pointer is a SmallInteger which means that the instances of SmallInteger are 31-bits in length. One can also write code to check this maximum; it also indicates a 31-bit length for SmallIntegers.
The comment should be fixed. Attached is code to change the comment to:
My instances are 31-bit numbers, stored in twos complement form. The allowable range is approximately +- 2 billion (see SmallInteger minVal, maxVal).
(This is another contribution for most trivial bug fix.)
Dave
On Sun, 9 Sep 2001, David N. Smith (IBM) wrote:
The comment should be fixed. Attached is code to change the comment to:
My instances are 31-bit numbers, stored in twos complement form. The allowable range is approximately +- 2 billion (see SmallInteger minVal, maxVal).
(This is another contribution for most trivial bug fix.)
A 31-bit twos-complement number ranges over -+ 1 billion. So you've traded a fix for another bug. ;)
Fixing a bug in the comment. I must have run out of fingers when trying to compute 1 billion...
At 17:28 -0400 9/9/01, David N. Smith (IBM) wrote:
This was once submitted as a [BUG] and with no [FIX].
The class comment in SmallInteger states:
My instances are 30-bit numbers, stored in twos complement form. The allowable range is approximately +- 1 billion (see SmallInteger minVal, maxVal).
which is wrong. The virtual machine uses a one bit tag to indicate that the rest of the 32 bit object pointer is a SmallInteger which means that the instances of SmallInteger are 31-bits in length. One can also write code to check this maximum; it also indicates a 31-bit length for SmallIntegers.
The comment should be fixed. Attached is code to change the comment to:
My instances are 31-bit numbers, stored in twos complement form. The allowable range is approximately +- 1 billion (see SmallInteger minVal, maxVal).
(This is another contribution for most trivial bug fix.)
Dave Attachment converted: PBG3:SmallInteger Class Comment. (SIT5/SIT!) (000CD810)
squeak-dev@lists.squeakfoundation.org