The OpenD Programming Language

BitpackField

BitpackField is used by bitpack.

@fmamath
struct BitpackField (
Field
uint pack
I = typeof(cast()Field.init[size_t.init])
) if (
__traits(isUnsigned, I)
) {}

Members

Functions

assumeFieldsHaveZeroShift
auto assumeFieldsHaveZeroShift()

Defined if Field has member assumeFieldsHaveZeroShift.

lightConst
auto lightConst()
lightImmutable
auto lightImmutable()

Variables

_field
Field _field;

Examples

import mir.ndslice.iterator: FieldIterator;
ushort[10] data;
auto f = FieldIterator!(BitpackField!(ushort*, 6))(0, BitpackField!(ushort*, 6)(data.ptr));
f[0] = cast(ushort) 31;
f[1] = cast(ushort) 13;
f[2] = cast(ushort)  8;
f[3] = cast(ushort) 43;
f[4] = cast(ushort) 28;
f[5] = cast(ushort) 63;
f[6] = cast(ushort) 39;
f[7] = cast(ushort) 23;
f[8] = cast(ushort) 44;

assert(f[0] == 31);
assert(f[1] == 13);
assert(f[2] ==  8);
assert(f[3] == 43);
assert(f[4] == 28);
assert(f[5] == 63);
assert(f[6] == 39);
assert(f[7] == 23);
assert(f[8] == 44);
assert(f[9] == 0);
assert(f[10] == 0);
assert(f[11] == 0);

Meta