memory - Why would a program compiled for a SPARC ISA read an integer differently than on a Pentium ISA? -
a program compiled sparc isa writes 32-bit unsigned integer 0xabcdef01 file, , reads correctly. same program compiled pentium isa works correctly. however, when file transferred, program incorrectly reads integer file 0x01efcdab. going wrong?
sparc , pentium use different byte ordering ("endianness") in memory , on storage:
- sparc uses big-endian: most-significant byte of integer comes first
- pentium uses little-endian: least-significant byte of integer comes first
i.e. when file transferred machine different endianness, bytes of integer seem in reversed order.
Comments
Post a Comment