The Trunk: Balloon-fbs.22.mcz

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

The Trunk: Balloon-fbs.22.mcz

commits-2
Frank Shearar uploaded a new version of Balloon to project The Trunk:
http://source.squeak.org/trunk/Balloon-fbs.22.mcz

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

Name: Balloon-fbs.22
Author: fbs
Time: 25 July 2013, 8:19:08.919 am
UUID: 373e2c3f-9ac6-764b-8bed-b07b351f8144
Ancestors: Balloon-nice.21

SmalltalkImage current -> Smalltalk.

=============== Diff against Balloon-nice.21 ===============

Item was changed:
  ----- Method: ShortIntegerArray class>>startUpFrom: (in category 'class initialization') -----
  startUpFrom: anImageSegment
  "In this case, do we need to swap word halves when reading this segement?"
 
+ ^ (Smalltalk endianness) ~~ (anImageSegment endianness)
- ^ (SmalltalkImage current  endianness) ~~ (anImageSegment endianness)
  ifTrue: [Message selector: #swapShortObjects] "will be run on each instance"
  ifFalse: [nil].
  !

Item was changed:
  ----- Method: ShortIntegerArray>>restoreEndianness (in category 'objects from disk') -----
  restoreEndianness
  "This word object was just read in from a stream.  It was stored in Big Endian (Mac) format.  Swap each pair of bytes (16-bit word), if the current machine is Little Endian.
  Why is this the right thing to do?  We are using memory as a byteStream.  High and low bytes are reversed in each 16-bit word, but the stream of words ascends through memory.  Different from a Bitmap."
 
  | hack blt |
+ Smalltalk isLittleEndian ifTrue: [
- SmalltalkImage current  isLittleEndian ifTrue: [
  "The implementation is a hack, but fast for large ranges"
  hack := Form new hackBits: self.
  blt := (BitBlt toForm: hack) sourceForm: hack.
  blt combinationRule: Form reverse.  "XOR"
  blt sourceY: 0; destY: 0; height: hack height; width: 1.
  blt sourceX: 0; destX: 1; copyBits.  "Exchange bytes 0 and 1"
  blt sourceX: 1; destX: 0; copyBits.
  blt sourceX: 0; destX: 1; copyBits.
  blt sourceX: 2; destX: 3; copyBits.  "Exchange bytes 2 and 3"
  blt sourceX: 3; destX: 2; copyBits.
  blt sourceX: 2; destX: 3; copyBits
  ].
  !

Item was changed:
  ----- Method: ShortIntegerArray>>writeOn: (in category 'objects from disk') -----
  writeOn: aStream
 
  aStream nextInt32Put: self basicSize.
 
  1 to: self basicSize do: [ :i | | w |
  w := self basicAt: i.
+ Smalltalk isLittleEndian
- SmalltalkImage current  isLittleEndian
  ifFalse: [ aStream nextNumber: 4 put:  w ]
  ifTrue: [ aStream
  nextPut: (w digitAt: 2);
  nextPut: (w digitAt: 1);
  nextPut: (w digitAt: 4);
  nextPut: (w digitAt: 3) ]].!

Item was changed:
  ----- Method: ShortRunArray class>>startUpFrom: (in category 'class initialization') -----
  startUpFrom: anImageSegment
  "In this case, do we need to swap word halves when reading this segement?"
 
+ ^Smalltalk endianness ~~ anImageSegment endianness
- ^SmalltalkImage current endianness ~~ anImageSegment endianness
  ifTrue: [Message selector: #swapRuns "will be run on each instance"]
  ifFalse: [nil]!

Item was changed:
  ----- Method: ShortRunArray>>restoreEndianness (in category 'objects from disk') -----
  restoreEndianness
  "This word object was just read in from a stream.  It was stored in Big Endian (Mac) format.  Swap each pair of bytes (16-bit word), if the current machine is Little Endian.
  Why is this the right thing to do?  We are using memory as a byteStream.  High and low bytes are reversed in each 16-bit word, but the stream of words ascends through memory.  Different from a Bitmap."
 
  | w b1 b2 b3 b4 |
+ Smalltalk isLittleEndian ifTrue: [
- SmalltalkImage current  isLittleEndian ifTrue: [
  1 to: self basicSize do: [:i |
  w := self basicAt: i.
  b1 := w digitAt: 1.
  b2 := w digitAt: 2.
  b3 := w digitAt: 3.
  b4 := w digitAt: 4.
  w := (b1 << 24) + (b2 << 16) + (b3 << 8) + b4.
  self basicAt: i put: w.
  ]
  ].
 
  !