From: Mathieu Bouchard Date: 2001-01-20T13:17:44+09:00 Subject: [ruby-talk:9582] Re: Fast, loose, and out of control On Sat, 20 Jan 2001, Conrad Schneiker wrote: > What is the recommended Ruby way to determine whether you are (or a > particular thread is) running on a big-endian or little-endian CPU? I don't know the official way, but this one seems simple: "%08x"% ([0x04030201].pack'l').unpack('N')[0] returns "04030201" for big endian returns "01020304" for little endian returns something else for something else. also: [1].pack('l')[0] returns 0 on big endian returns 1 on little endian matju