mask

Masks, at run-time, a byte, a nibble or a bit in the argument.

  1. auto mask(T value)
  2. auto mask(T value, size_t index)
    nothrow @safe pure
    mask
    (
    const T value
    ,
    size_t index
    )

Parameters

index size_t

the position, 0-based, of the element to mask.

kind

the kind of the element to mask.

value T

the value mask.

Return Value

Type: auto

The input argument with the element masked.

Examples

// MaskKind.Byte by default.
assert(mask(0x12345678,1) == 0x12340078);
assert(mask!(MaskKind.Nibble)(0x12345678,1) == 0x12345608);

Meta