[squeak-dev] The Trunk: System-eem.801.mcz

Tobias Pape Das.Linux at gmx.de
Sun Feb 21 11:26:01 UTC 2016


On 21.02.2016, at 07:40, commits at source.squeak.org wrote:

> 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'!

Well, If we had Squeak on a PDP-11, we would have also middle endian:
https://en.wikipedia.org/wiki/Endianness#Middle-endian ;)

Best regards
	-Tobias

> - 
> - 	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 Squeak-dev mailing list