[Pkg] The Trunk: System-eem.801.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Feb 21 07:40:38 UTC 2016
Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.801.mcz
==================== Summary ====================
Name: System-eem.801
Author: eem
Time: 20 February 2016, 11:40:02.089874 pm
UUID: cb00963a-1c90-40c0-9539-04c88c0afa5f
Ancestors: System-mt.800
In Spur calcEndianness can be a lot simpler.
=============== Diff against System-mt.800 ===============
Item was changed:
----- Method: SmalltalkImage>>calcEndianness (in category 'system attributes') -----
calcEndianness
- | bytes word blt |
"What endian-ness is the current hardware? The String '1234' will be stored into a machine word. On BigEndian machines (the Mac), $1 will be the high byte if the word. On LittleEndian machines (the PC), $4 will be the high byte."
"Smalltalk endianness"
+ | wordThenBytes |
+ wordThenBytes := WordArray with: 16r01020304.
+ ByteArray adoptInstance: wordThenBytes.
+ wordThenBytes first = 1 ifTrue: [^#big].
+ wordThenBytes first = 4 ifTrue: [^#little].
+ self error: 'The author is confused'!
-
- bytes := ByteArray withAll: #(0 0 0 0). "(1 2 3 4) or (4 3 2 1)"
- word := WordArray with: 16r01020304.
- blt := (BitBlt toForm: (Form new hackBits: bytes))
- sourceForm: (Form new hackBits: word).
- blt combinationRule: Form over. "store"
- blt sourceY: 0; destY: 0; height: 1; width: 4.
- blt sourceX: 0; destX: 0.
- blt copyBits. "paste the word into the bytes"
- bytes first = 1 ifTrue: [^ #big].
- bytes first = 4 ifTrue: [^ #little].
- self error: 'Ted is confused'.!
More information about the Packages
mailing list