Skip to content

Rose::BitOps::replicate

Replicate low‐order bits to fill return value.

Synopsis

Declared in <src/Rose/BitOps.h>

template<typename Unsigned>
Unsigned
replicate(
    Unsigned src,
    size_t n);

Description

The n low‐order bits of src are repeated as a group as many times as necessary to fill the entire return value. For instance, if src contains 0xabcdef and n is 8 and the return type is a 32‐bit unsigned integer, then the return value will be 0xefefefef. If the width of the return value is not an integer multiple of n, then the high order bits of the return value will contain only some of the lowest order bits of the src. The value of n cannot be zero.

Return Value

Replicated value.

Parameters

Name

Description

src

Input value.

n

Width of the pattern to replicate.

Created with MrDocs