The OpenD Programming Language

UInt

Fixed-length unsigned integer.

struct UInt (
size_t size
) if (
size % (size_t.sizeof * 8) == 0 &&
size >= size_t.sizeof * 8
) {}

Constructors

this
this(size_t[N] data)
this
this(UInt!argSize arg)
this
this(ulong[data.length / 2] data)
this
this(ulong data)
this
this(uint data)
this
this(const(C)[] str)

Members

Functions

bt
bool bt(size_t position)
ctlz
size_t ctlz()
cttz
size_t cttz()
divMod
ref divMod(UInt!rhsSize rhs)

Performs division & extracts the remainder.

fromBinaryStringImpl
bool fromBinaryStringImpl(const(C)[] str)
fromHexStringImpl
bool fromHexStringImpl(const(C)[] str)
fromStringImpl
bool fromStringImpl(const(C)[] str)
opAssign
UInt!size opAssign(ulong rhs)
opAssign
UInt!size opAssign(uint rhs)
opAssign
UInt!size opAssign(UInt!rhsSize rhs)
opBinary
UInt!size opBinary(size_t rhs)

auto c = a << b operation.

opCast
T opCast()
opCast
T opCast()
opCast
T opCast()
opCast
T opCast()
opCmp
auto opCmp(UInt!size rhs)
auto opCmp(ulong rhs)
opEquals
auto opEquals(UInt!rhsSize rhs)
auto opEquals(ulong rhs)
opOpAssign
bool opOpAssign(UInt!size rhs, bool overflow)
bool opOpAssign(size_t rhs)
bool opOpAssign(ulong rhs)
bool opOpAssign(UInt!rsize rhs, bool overflow)

bool overflow = a += b and bool overflow = a -= b operations.

opOpAssign
size_t opOpAssign(size_t rhs, size_t carry)
auto opOpAssign(ulong rhs)
opOpAssign
void opOpAssign(UInt!rhsSize rhs)
opOpAssign
uint opOpAssign(uint rhs, uint overflow)

Performs uint remainder = (overflow$big) /= scalar operatrion, where $ denotes big-endian concatenation. Precondition: overflow < rhs

opOpAssign
ref opOpAssign(UInt!rhsSize rhs)
ref opOpAssign(ulong rhs)

Performs big /= rhs operation.

opOpAssign
ref opOpAssign(UInt!rhsSize rhs)

Performs big %= rhs operation.

opOpAssign
UInt!size opOpAssign(UInt!size rhs)
opOpAssign
UInt!size opOpAssign(size_t rhs)
opOpAssign
UInt!size opOpAssign(size_t shift)
rightExtend
UInt!(size + additionalRightBits) rightExtend()
signBit
bool signBit()
void signBit(bool value)
smallLeftShift
UInt!size smallLeftShift(uint shift)

Shifts left using at most size_t.sizeof * 8 - 1 bits

smallRightShift
UInt!size smallRightShift(uint shift)

Shifts right using at most size_t.sizeof * 8 - 1 bits

toSize
UInt!newSize toSize()
toString
immutable(C)[] toString()
toString
void toString(W w)
view
BigUIntView!size_t view()
view
BigUIntView!(const size_t) view()

Static functions

fromBinaryString
UInt!size fromBinaryString(const(char)[] str)
fromHexString
UInt!size fromHexString(const(char)[] str)

Templates

opBinary
template opBinary(string op)
opBinaryRight
template opBinaryRight(string op)

Binary operations

Variables

data
size_t[size / (size_t.sizeof * 8)] data;

Payload. The data is located in the target endianness.

max
enum UInt!size max;
min
enum UInt!size min;

Parameters

size

size in bits

Meta