The Trunk: Kernel-eem.901.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-eem.901.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.901.mcz

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

Name: Kernel-eem.901
Author: eem
Time: 13 February 2015, 1:00:47.881 pm
UUID: 01852b3d-2d73-4a23-8de0-7ca117279435
Ancestors: Kernel-nice.900

Make Integer class>>byte1:byte2:byte3:byte4: 64-bit
Spur savvy, and add a similarly savvy
byte1:byte2:byte3:byte4:byte5:byte6:byte7:byte8:

=============== Diff against Kernel-nice.900 ===============

Item was changed:
  ----- Method: Integer class>>byte1:byte2:byte3:byte4: (in category 'instance creation') -----
+ byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4
+ "Depending on the size of SmallInteger maxVal and the high-order byte,
+ either copy directly into a LargeInteger, or build up a SmallInteger by shifting"
- byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4
- "Depending on high-order byte copy directly into a LargeInteger,
- or build up a SmallInteger by shifting"
  | value |
+ ((SmallInteger maxVal > 1073741823)
+ or: [byte4 < 16r40]) ifTrue:
- byte4 < 16r40 ifTrue:
  [^ (byte4 bitShift: 24)
  + (byte3 bitShift: 16)
  + (byte2 bitShift: 8)
  + byte1].
  value := LargePositiveInteger new: 4.
  value digitAt: 4 put: byte4.
  value digitAt: 3 put: byte3.
  value digitAt: 2 put: byte2.
  value digitAt: 1 put: byte1.
+ ^value!
- ^ value!

Item was added:
+ ----- Method: Integer class>>byte1:byte2:byte3:byte4:byte5:byte6:byte7:byte8: (in category 'instance creation') -----
+ byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4 byte5: byte5 byte6: byte6 byte7: byte7 byte8: byte8
+ "Depending on the size of SmallInteger maxVal and the high-order byte,
+ either copy directly into a LargeInteger, or build up a SmallInteger by shifting"
+ | value |
+ (SmallInteger maxVal > 1073741823
+ ifTrue: [byte8 <= (SmallInteger maxVal digitAt: 8)]
+ ifFalse: [byte5 + byte6 + byte7 = 0 and: [byte4 < 16r40]]) ifTrue:
+ [^ (byte8 bitShift: 56)
+ + (byte7 bitShift: 48)
+ + (byte6 bitShift: 40)
+ + (byte5 bitShift: 32)
+ + (byte4 bitShift: 24)
+ + (byte3 bitShift: 16)
+ + (byte2 bitShift: 8)
+ + byte1].
+ value := LargePositiveInteger new: 8.
+ value digitAt: 8 put: byte8.
+ value digitAt: 7 put: byte7.
+ value digitAt: 6 put: byte6.
+ value digitAt: 5 put: byte5.
+ value digitAt: 4 put: byte4.
+ value digitAt: 3 put: byte3.
+ value digitAt: 2 put: byte2.
+ value digitAt: 1 put: byte1.
+ ^value!