The Trunk: Kernel-nice.1332.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-nice.1332.mcz

commits-2
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1332.mcz

==================== Summary ====================

Name: Kernel-nice.1332
Author: nice
Time: 25 June 2020, 1:40:53.258508 am
UUID: 1a712e0e-296b-394e-ad45-7374959e1d30
Ancestors: Kernel-tonyg.1331

Fix the bug found in Cuis by Luciano Notarfrancesco and resolved by Juan Vuletich

i:=0.
[a := (1 << 60) atRandom.
        b := (a bitReverse: 64) bitReverse: 64.
        a = b] whileTrue:[i:=i+1].
^i

Above loop should not stop.
But unnormalized Integer were sometimes returned,

=============== Diff against Kernel-tonyg.1331 ===============

Item was changed:
  ----- Method: LargePositiveInteger>>bitReverse: (in category 'bit manipulation') -----
  bitReverse: highBit
  "This implementation is faster than super"
 
  | digitSize reversed |
  highBit < self highBit ifTrue: [ self error: 'Not enough bits.' ].
  digitSize := highBit + 7 // 8.
  reversed := self class new: digitSize.
  1 to: self digitLength do: [:i |
  reversed digitAt: digitSize + 1 - i put: (self digitAt: i) byteReversed].
+ ^reversed normalize bitShift: highBit - (digitSize * 8)!
- ^reversed bitShift: highBit - (digitSize * 8)!