Little Endian vs Big Endian?

Little endian is basically reversing the byte order for a multi byte value. 1111 1111 1111 0100 is a 2 byte value where 1111 1111 is the first byte and 1111 0100 is the second byte. In little endian, the second byte (or least significant byte) is read in first so the final representation is … Read more

C# – Binary reader in Big Endian?

I’m not usually one to answer my own questions, but I’ve accomplished exactly what I wanted with some simple code: class BinaryReader2 : BinaryReader { public BinaryReader2(System.IO.Stream stream) : base(stream) { } public override int ReadInt32() { var data = base.ReadBytes(4); Array.Reverse(data); return BitConverter.ToInt32(data, 0); } public Int16 ReadInt16() { var data = base.ReadBytes(2); Array.Reverse(data); … Read more

Floating point Endianness?

According to Wikipedia, Floating-point and endianness On some machines, while integers were represented in little-endian form, floating point numbers were represented in big-endian form. Because there are many floating point formats, and a lack of a standard “network” representation, no standard for transferring floating point values has been made. This means that floating point data … Read more

The reason behind endianness?

I’ve looked around the net a bit for more information on this question and there is a quite a range of answers and reasonings to explain why big or little endian ordering may be preferable. I’ll do my best to explain here what I found: Little-endian The obvious advantage to little-endianness is what you mentioned … Read more