[Vm-dev] VM endianness

David T. Lewis lewis at mail.msen.com
Fri Apr 3 12:01:30 UTC 2015


On Fri, Apr 03, 2015 at 08:40:58AM +0000, Guillermo Polito wrote:
>  
> So, following with this discussion ^^
> 
> This is the latest version we are using.
> 
> f := Float new: 2.
> f at: 2 put: 1. "store the least significant word of the float with 1; on
> big endian machines this is the second word"
> Bitmap adoptInstance: f.
> ^ f first = 1 ifTrue: [#little] ifFalse: [#big]
> 
> works, because both Float and Bitmap are compact. I just state it because
> to use another variable word class we should make it compact too.
> 
> Thanks,
> Guille

FYI:

With in interpreter VM on Intel (which uses the original float ordering from
earlier Squeak images), you get a different result:

  f := Float new: 2.
  f at: 2 put: 1. "store the least significant word of the float with 1; on
  big endian machines this is the second word"
  Bitmap adoptInstance: f.
  ^ f first = 1 ifTrue: [#little] ifFalse: [#big] "==> #big"
  
  Smalltalk isBigEndian "==> false"

This will not be an issue on Cog or Spur.

Dave



More information about the Vm-dev mailing list