NetworkOrder

Represents an unsigned integer as an $(D_KEYWORD ubyte) range.

The range is bidirectional. The byte order is always big-endian.

It can accept any unsigned integral type but the value should fit in L bytes.

Constructors

this
this(T value)

Constructs a new range.

Members

Functions

popBack
void popBack()

Eliminates the LSB.

popFront
void popFront()

Eliminates the MSB.

save
typeof(this) save()

Properties

back
ubyte back [@property getter]
empty
bool empty [@property getter]
front
ubyte front [@property getter]
length
size_t length [@property getter]

Parameters

L

Desired range length.

Examples

auto networkOrder = NetworkOrder!3(0xae34e2u);
assert(!networkOrder.empty);
assert(networkOrder.front == 0xae);

networkOrder.popFront();
assert(networkOrder.length == 2);
assert(networkOrder.front == 0x34);
assert(networkOrder.back == 0xe2);

networkOrder.popBack();
assert(networkOrder.length == 1);
assert(networkOrder.front == 0x34);
assert(networkOrder.front == 0x34);

networkOrder.popFront();
assert(networkOrder.empty);

Meta