Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz ==================== Summary ==================== Name: CollectionsTests-nice.255 Author: nice Time: 31 October 2015, 6:39:25.525 pm UUID: 4f5361b3-18c8-47f1-ba59-030004683963 Ancestors: CollectionsTests-ul.254 In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it. =============== Diff against CollectionsTests-ul.254 =============== Item was changed: ----- Method: IntegerArrayTest>>testStoreSmallInteger (in category 'tests') ----- testStoreSmallInteger + "Any SmallInteger may be stored in an IntegerArray in a 32bits VM. + Not so true for a 64bits spur VM though..." - "Any SmallInteger may be stored in an IntegerArray." | ia val | ia := IntegerArray new: 1. + val := Smalltalk wordSize = 8 + ifTrue: [1 << 31 - 1] + ifFalse: [SmallInteger maxVal]. - val := SmallInteger maxVal. ia at: 1 put: val. self assert: ((ia at: 1) = val). + val := Smalltalk wordSize = 8 + ifTrue: [(1 << 31) negated] + ifFalse: [SmallInteger minVal]. - val := SmallInteger minVal. ia at: 1 put: val. self assert: ((ia at: 1) = val) ! |
On 31.10.2015, at 17:39, [hidden email] wrote: > Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk: > http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz > > ==================== Summary ==================== > > Name: CollectionsTests-nice.255 > Author: nice > Time: 31 October 2015, 6:39:25.525 pm > UUID: 4f5361b3-18c8-47f1-ba59-030004683963 > Ancestors: CollectionsTests-ul.254 > > In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it. > Eh… Shouldn't we rather fix IntegerArray then? Best -Tobias > =============== Diff against CollectionsTests-ul.254 =============== > > Item was changed: |
On Sat, Oct 31, 2015 at 08:45:44PM +0100, Tobias Pape wrote:
> > On 31.10.2015, at 17:39, [hidden email] wrote: > > > Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk: > > http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz > > > > ==================== Summary ==================== > > > > Name: CollectionsTests-nice.255 > > Author: nice > > Time: 31 October 2015, 6:39:25.525 pm > > UUID: 4f5361b3-18c8-47f1-ba59-030004683963 > > Ancestors: CollectionsTests-ul.254 > > > > In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it. > > > > Eh? > Shouldn't we rather fix IntegerArray then? > Best > -Tobias > No. From the class comment: IntegerArrays store 32bit signed Integer values. Negative values are stored as 2's complement. Therefore the range of SmallInteger may now exceed the range of a 32bit twos complement integer, and this should be documented. Dave |
On 31.10.2015, at 20:54, David T. Lewis <[hidden email]> wrote: > On Sat, Oct 31, 2015 at 08:45:44PM +0100, Tobias Pape wrote: >> >> On 31.10.2015, at 17:39, [hidden email] wrote: >> >>> Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk: >>> http://source.squeak.org/trunk/CollectionsTests-nice.255.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: CollectionsTests-nice.255 >>> Author: nice >>> Time: 31 October 2015, 6:39:25.525 pm >>> UUID: 4f5361b3-18c8-47f1-ba59-030004683963 >>> Ancestors: CollectionsTests-ul.254 >>> >>> In a 64bits spur VM, not all SmallInteger can be stored in an IntegerArray, It's time to document it. >>> >> >> Eh? >> Shouldn't we rather fix IntegerArray then? >> Best >> -Tobias >> > > No. From the class comment: > > IntegerArrays store 32bit signed Integer values. > Negative values are stored as 2's complement. > > Therefore the range of SmallInteger may now exceed the range of a > 32bit twos complement integer, and this should be documented. Oh, ok then. Best -Tobias |
Free forum by Nabble | Edit this page |