({{, (RefLink[$ByteOrdering, paclet:ref/$ByteOrdering])
gives the native ordering of bytes in binary data on your computer system. }})

OpenersNotesSection(Spacer1)Details

Possible values of (RefLink[$ByteOrdering, paclet:ref/$ByteOrdering]) are +1 and -1.

+1 corresponds to big endian (appropriate for 680x0 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 (RefLink[IntegerDigits, paclet:ref/IntegerDigits])[n,256].

(RefLink[$ByteOrdering, paclet:ref/$ByteOrdering]) gives the default setting for the (RefLink[ByteOrdering, paclet:ref/ByteOrdering]) option in (RefLink[Import, paclet:ref/Import]) and (RefLink[Export, paclet:ref/Export]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Byte ordering on this machine:

$ByteOrdering

Read in a byte stream with reversed byte ordering:

ImportString[ExportString[12345,"Integer32"],"Integer32",ByteOrdering->-$ByteOrdering]//First

Correct the byte ordering:

FromDigits[Reverse[IntegerDigits[%,2^8,4]],2^8]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[$ProcessorType, paclet:ref/$ProcessorType])  ▪  (RefLink[$System, paclet:ref/$System])  ▪  (RefLink[$CharacterEncoding, paclet:ref/$CharacterEncoding])  ▪  (RefLink[ByteOrdering, paclet:ref/ByteOrdering])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Global System Information, paclet:tutorial/GlobalSystemInformation])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Binary Data, paclet:guide/BinaryData])}, {▪(RefLinkPlain[System Information, paclet:guide/SystemInformation])}})}})