ByteOrdering

ByteOrdering

is an option for BinaryRead, BinaryWrite, and related functions that specifies what ordering of bytes should be assumed for your computer system.

Details

  • Possible settings for ByteOrdering are +1 and -1.
  • +1 corresponds to big endian (appropriate for PowerPC and many other processors); -1 corresponds to little endian (appropriate for x86 processors).
  • +1 corresponds to having the most-significant byte first; -1 to having the least-significant byte first.
  • +1 is the order obtained from IntegerDigits[n,256].

Examples

Basic Examples  (2)

$ByteOrdering gives the byte ordering on this machine:

Create a file with a 32-bit integer:

Read the data from the file:

Read the data with reverse byte ordering:

Recreate the correct interpretation using Wolfram Language functions:

Wolfram Research (2005), ByteOrdering, Wolfram Language function, https://reference.wolfram.com/language/ref/ByteOrdering.html.

Text

Wolfram Research (2005), ByteOrdering, Wolfram Language function, https://reference.wolfram.com/language/ref/ByteOrdering.html.

CMS

Wolfram Language. 2005. "ByteOrdering." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ByteOrdering.html.

APA

Wolfram Language. (2005). ByteOrdering. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ByteOrdering.html

BibTeX

@misc{reference.wolfram_2023_byteordering, author="Wolfram Research", title="{ByteOrdering}", year="2005", howpublished="\url{https://reference.wolfram.com/language/ref/ByteOrdering.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_byteordering, organization={Wolfram Research}, title={ByteOrdering}, year={2005}, url={https://reference.wolfram.com/language/ref/ByteOrdering.html}, note=[Accessed: 19-March-2024 ]}