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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -