From: Eric Hodel Date: 2006-11-16T06:19:24+09:00 Subject: Re: Endianess of the underlying platform On Oct 24, 2006, at 4:40 PM, Tim Pease wrote: > Does ruby provide a global or a method call to determine the endianess > of the underlying platform? > > This is what I cooked up, but I'm wondering if there is a ruby way of > doing this. > > BIG_ENDIAN = [0xFF00].pack('S') == [0xFF00].pack('n') Beware, some versions of ruby shipped with OS X have a broken pack where the endianness is swapped. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com