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

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World