The Trunk: System-ul.1147.mcz

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

The Trunk: System-ul.1147.mcz

commits-2
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.1147.mcz

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

Name: System-ul.1147
Author: ul
Time: 18 March 2020, 7:45:34.703617 pm
UUID: 28584d2a-ac1b-4e16-a2fe-8a12694179c4
Ancestors: System-eem.1146

- fix: make ThirtyTwoBitRegister >> leftRotateBy: work when the argument is negative

=============== Diff against System-eem.1146 ===============

Item was changed:
  ----- Method: ThirtyTwoBitRegister>>leftRotateBy: (in category 'accumulator ops') -----
  leftRotateBy: bits
  "Rotate my contents left by the given number of bits, retaining exactly 32 bits."
  "Details: Perform this operation with no LargeInteger arithmetic."
 
  | bitCount newHi |
+ bitCount := bits \\ 32. "Ensure bitCount is between 0 and 31"
- bitCount := bits.
- bitCount >= 32 ifTrue: [ bitCount := bitCount \\ 32 ].
  bitCount >= 16 ifTrue: [
  newHi := low.
  low := hi.
  hi := newHi.
  bitCount := bitCount - 16 ].
  bitCount >= 15 ifTrue: [
  newHi := ((hi bitAnd: 16r1) bitShift: 15) bitOr: (low bitShift: -1).
  low := ((low bitAnd: 16r1) bitShift: 15) bitOr: (hi bitShift: -1).
  hi := newHi.
  ^self ].
  bitCount >= 1 ifTrue: [
  | shift |
  shift := bitCount - 16.
  newHi := ((hi bitShift: bitCount) bitAnd: 16rFFFF) bitOr: (low bitShift: shift).
  low := ((low bitShift: bitCount) bitAnd: 16rFFFF) bitOr: (hi bitShift: shift).
  hi := newHi ]!