Skip to content

Rose::BitOps::shiftLeftLsb

Left shift part of a value without affecting the rest.

Synopsis

Declared in <src/Rose/BitOps.h>

template<typename Unsigned>
Unsigned
shiftLeftLsb(
    Unsigned src,
    size_t w,
    size_t n,
    bool b = false);

Description

The value src has its low‐order w bits shifted n places toward higher order. The highest bits are discarded and the n new lower order bits are either set or cleared depending on the value of b. If n is greater than or equal to w then all affected bits are set or cleared, depending on b. The bits not in the affected range are not affected and are returned.

Return Value

Updated value.

Parameters

Name

Description

src

Input value.

w

Width of the low‐order region.

n

Shift count.

b

Fill bit value.

Created with MrDocs