The OpenD Programming Language

bitwise

Bitwise slice over an integral slice.

  1. auto bitwise(Slice!(Iterator, N, kind) slice)
    bitwise
    (
    Iterator
    size_t N
    SliceKind kind
    I = typeof(Iterator.init[size_t.init])
    )
    (
    Slice!(Iterator, N, kind) slice
    )
    if (
    __traits(isIntegral, I) &&
    (
    kind != Universal ||
    N == 1
    )
    )
  2. auto bitwise(T[] array)
  3. auto bitwise(T withAsSlice)

Parameters

slice Slice!(Iterator, N, kind)

a contiguous or canonical slice on top of integral iterator.

Return Value

Type: auto

A bitwise slice.

Examples

size_t[10] data;
auto bits = data[].bitwise;
assert(bits.length == data.length * size_t.sizeof * 8);
bits[111] = true;
assert(bits[111]);

bits.popFront;
assert(bits[110]);
bits[] = true;
bits[110] = false;
bits = bits[10 .. $];
assert(bits[100] == false);

Meta