mask

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

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

Parameters

index
Type: size_t

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

kind

the kind of the element to mask.

value
Type: 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