Template Function Rose::BitOps::replicate

Template Function Rose::BitOps::replicate#

Function Documentation#

template<typename Unsigned>
inline Unsigned Rose::BitOps::replicate(Unsigned src, size_t n)#

Replicate low-order bits to fill return value.

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.