Robert Feldt <feldt / ce.chalmers.se> 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