Skip to content

Endianness

Endianness refers to the order in which bytes of data are stored in computer memory. There are two main types of endianness: big-endian and little-endian.

In a big-endian system, the most significant byte (the one with the highest value) of a word is stored at the smallest memory address, while the least significant byte (the one with the lowest value) is stored at the largest memory address.

On the other hand, in a little-endian system, the least significant byte is stored at the smallest memory address, and the most significant byte is stored at the largest memory address.

The endianness of the source data can be specified when creating a buffer. The default is big-endian.

var buffer = WrappedByteBuffer( source, Endianness.BigEndian );

When using Channels, you won't usually need to manually create a buffer instance, so this behaviour has to be set while configuring the channel.

services.AddChannels( channel =>
{
    // configure channel options
    channel.Configure( options =>
    {
        // this is the default
        options.BufferEndianness = Endianness.BigEndian;
    } );

} );