Endian defined:
Endianness is a term that describes the order in which a sequence of bytes is stored in computer memory. Endianness can be either big or small, with the adjectives referring to which value is stored first.Big Endian (BE): stores the most significant byte of a word at the smallest memory address.
Little Endian (LE): stores the least significant byte of a word at the smallest memory address.
Endianness generally differs across operating system (OS) platforms, and is encountered when processing binary data in files or network calls.
// Is this OS Little Endian
Endianness generally differs across operating system (OS) platforms, and is encountered when processing binary data in files or network calls.
Generally, Microsoft Windows is Little Endian. However Mac and other Unix based OS actually vary between Big and Little Endian.
Handling Endian in C#
// Converts the input if necessary, to be big-Endian.
System.Net.IPAddress.HostToNetworkOrder(int input)
// This follows a convention: to work with computers that use different byte ordering, all integer values that are sent over the network are sent in network byte order which has the most significant byte first.
// Is this OS Little Endian
// Reverses the Endianness of the input
Comments
Post a Comment