Trait amplify::num::BitArray[][src]

pub trait BitArray {
    fn bit(&self, idx: usize) -> bool;
fn bit_slice(&self, start: usize, end: usize) -> Self;
fn mask(&self, n: usize) -> Self;
fn trailing_zeros(&self) -> usize;
fn zero() -> Self;
fn one() -> Self; }
Expand description

A trait which allows numbers to act as fixed-size bit arrays

Required methods

fn bit(&self, idx: usize) -> bool[src]

Expand description

Is bit set?

fn bit_slice(&self, start: usize, end: usize) -> Self[src]

Expand description

Returns an array which is just the bits from start to end

fn mask(&self, n: usize) -> Self[src]

Expand description

Bitwise and with n ones

fn trailing_zeros(&self) -> usize[src]

Expand description

Trailing zeros

fn zero() -> Self[src]

Expand description

Create all-zeros value

fn one() -> Self[src]

Expand description

Create value representing one

Implementors

impl BitArray for u256[src]

fn bit(&self, index: usize) -> bool[src]

fn bit_slice(&self, start: usize, end: usize) -> u256[src]

fn mask(&self, n: usize) -> u256[src]

fn trailing_zeros(&self) -> usize[src]

fn zero() -> u256[src]

fn one() -> u256[src]

impl BitArray for u512[src]

fn bit(&self, index: usize) -> bool[src]

fn bit_slice(&self, start: usize, end: usize) -> u512[src]

fn mask(&self, n: usize) -> u512[src]

fn trailing_zeros(&self) -> usize[src]

fn zero() -> u512[src]

fn one() -> u512[src]

impl BitArray for u1024[src]

fn bit(&self, index: usize) -> bool[src]

fn bit_slice(&self, start: usize, end: usize) -> u1024[src]

fn mask(&self, n: usize) -> u1024[src]

fn trailing_zeros(&self) -> usize[src]

fn zero() -> u1024[src]

fn one() -> u1024[src]