2006年02月06日T19:47:48 Derek Baker: > At the moment, we're running on an eval board, and no one seems to know > if it's little or big. Is there any way to tell using some Linux tool? I'm almost there, with one little problem. I don't know lua well enough to do it there, so I'm doing it with perl. ; perl -le 'print((1<<24)+(2<<16)+(3<<8)+4)' 16909060 ; perl -e 'print pack("N",16909060)'|od -b 0000000 001 002 003 004 0000004 ; perl -e 'print pack("V",16909060)'|od -b 0000000 004 003 002 001 0000004 ; According to the doc in perldoc -f pack: N An unsigned long in "network" (big-endian) order. V An unsigned long in "VAX" (little-endian) order. They look opposite to me, but sobeit. If the first octet printed by od -b is 1, then it's big-endian, and if it's 4 then it's little-endian (presuming they're all in ascending or descending order, if they're scrambled then it's middle-endian). So that's our test number. On PPC: : minimac; perl -e 'print pack("I",16909060)'|od -b 0000000 001 002 003 004 0000004 : minimac; On x86: : pic; perl -e 'print pack("I",16909060)'|od -b 0000000 004 003 002 001 0000004 : pic; -Bennett
Attachment:
pgp_qE8Nhe9BL.pgp
Description: PGP signature