Trait malachite_base::num::logic::traits::LowMask

source ·
pub trait LowMask {
    // Required method
    fn low_mask(bits: u64) -> Self;
}
Expand description

Returns a number whose least significant $b$ bits are true and whose other bits are false.

Required Methods§

source

fn low_mask(bits: u64) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl LowMask for i8

source§

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.

source§

impl LowMask for i16

source§

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.

source§

impl LowMask for i32

source§

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.

source§

impl LowMask for i64

source§

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.

source§

impl LowMask for i128

source§

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.

source§

impl LowMask for isize

source§

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.

source§

impl LowMask for u8

source§

fn low_mask(bits: u64) -> u8

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

source§

impl LowMask for u16

source§

fn low_mask(bits: u64) -> u16

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

source§

impl LowMask for u32

source§

fn low_mask(bits: u64) -> u32

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

source§

impl LowMask for u64

source§

fn low_mask(bits: u64) -> u64

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

source§

impl LowMask for u128

source§

fn low_mask(bits: u64) -> u128

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

source§

impl LowMask for usize

source§

fn low_mask(bits: u64) -> usize

Returns a number whose least significant $b$ bits are true and whose other bits are false.

$f(b) = 2^b - 1$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if bits is greater than the width of of the type.

§Examples

See here.

Implementors§