From: Steve Coltrin Date: 2000-12-22T20:40:02+09:00 Subject: [ruby-talk:7949] Re: Determining endianness Robert Feldt writes: > We've previously discussed how to determine endianness in C code but can > you think of any way to do it in Ruby without compiling an extension? Here's how I do it: i = 0x01020304 case [i].pack('l') when [i].pack('V') $CFLAGS += " -DLITTLE_ENDIAN" when [i].pack('N') $CFLAGS += " -DBIG_ENDIAN" else p "Sorry, your machine has an unusual byte order which is not supported." exit! end -spc