IntegerArray>at: bug? [BUG] [FIX]
Tim Rowledge
rowledge at interval.com
Tue Mar 9 21:43:15 UTC 1999
I was just rying out IntegerArray and foud to my surprise that
a at: 1 put: -1.
a at: 1 => -3 !!
It looks to me like a minor bug got into #at: - a plausible looking fix is
enclosed.
'From Squeak 2.3 of January 14, 1999 on 9 March 1999 at 1:40:29 pm'!
!IntegerArray methodsFor: 'accessing' stamp: 'TPR 3/9/1999 13:37'!
at: index
| word |
word _ self basicAt: index.
word < 16r3FFFFFFF ifTrue:[^word]. "Avoid LargeInteger computations"
^word >= 16r80000000 "Negative?!!"
ifTrue:["word - 16r100000000"
(word bitInvert32 ) negated +1]
ifFalse:[word]! !
tim
--
Klingon Code Warrior:- 10) "This code is a piece of crap! You have no honor!"
Tim Rowledge: rowledge at interval.com (w) +1 (650) 842-6110 (w)
tim at sumeru.stanford.edu (h) <http://sumeru.stanford.edu/tim>
More information about the Squeak-dev
mailing list
|