Expand description
Returns a number whose least significant $b$ bits are true
and whose other bits are false
.
Required Methods
Implementations on Foreign Types
sourceimpl LowMask for i8
impl LowMask for i8
sourcefn low_mask(bits: u64) -> i8
fn low_mask(bits: u64) -> i8
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.
sourceimpl LowMask for i16
impl LowMask for i16
sourcefn low_mask(bits: u64) -> i16
fn low_mask(bits: u64) -> i16
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.
sourceimpl LowMask for i32
impl LowMask for i32
sourcefn low_mask(bits: u64) -> i32
fn low_mask(bits: u64) -> i32
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.
sourceimpl LowMask for i64
impl LowMask for i64
sourcefn low_mask(bits: u64) -> i64
fn low_mask(bits: u64) -> i64
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.
sourceimpl LowMask for i128
impl LowMask for i128
sourcefn low_mask(bits: u64) -> i128
fn low_mask(bits: u64) -> i128
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.
sourceimpl LowMask for isize
impl LowMask for isize
sourcefn low_mask(bits: u64) -> isize
fn low_mask(bits: u64) -> isize
Returns a number whose least significant $b$ bits are true
and whose other bits
are false
.
$$ f(b) = \begin{cases} 2^b - 1 & \text{if} \quad 0 \leq n < W, \\ -1 & \text{if} \quad n = W, \end{cases} $$ where $W$ is the width of the type.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if bits
is greater than the width of the type.
Examples
See here.