binius_field::underlier

Trait UnderlierWithBitOps

source
pub trait UnderlierWithBitOps:
    UnderlierType
    + BitAnd<Self, Output = Self>
    + BitAndAssign<Self>
    + BitOr<Self, Output = Self>
    + BitOrAssign<Self>
    + BitXor<Self, Output = Self>
    + BitXorAssign<Self>
    + Shr<usize, Output = Self>
    + Shl<usize, Output = Self>
    + Not<Output = Self> {
    const ZERO: Self;
    const ONE: Self;
    const ONES: Self;

    // Required method
    fn fill_with_bit(val: u8) -> Self;

    // Provided methods
    fn from_fn<T>(f: impl FnMut(usize) -> T) -> Self
       where T: UnderlierType,
             Self: From<T> { ... }
    fn broadcast_subvalue<T>(value: T) -> Self
       where T: UnderlierType,
             Self: From<T> { ... }
    unsafe fn get_subvalue<T>(&self, i: usize) -> T
       where T: UnderlierType + NumCast<Self> { ... }
    unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)
       where T: UnderlierWithBitOps,
             Self: From<T> { ... }
}
Expand description

Underlier type that supports bit arithmetic.

Required Associated Constants§

source

const ZERO: Self

source

const ONE: Self

source

const ONES: Self

Required Methods§

source

fn fill_with_bit(val: u8) -> Self

Fill value with the given bit val must be 0 or 1.

Provided Methods§

source

fn from_fn<T>(f: impl FnMut(usize) -> T) -> Self
where T: UnderlierType, Self: From<T>,

source

fn broadcast_subvalue<T>(value: T) -> Self
where T: UnderlierType, Self: From<T>,

Broadcast subvalue to fill Self. Self::BITS/T::BITS is supposed to be a power of 2.

source

unsafe fn get_subvalue<T>(&self, i: usize) -> T
where T: UnderlierType + NumCast<Self>,

Gets the subvalue from the given position. Function panics in case when index is out of range.

§Safety

i must be less than Self::BITS/T::BITS.

source

unsafe fn set_subvalue<T>(&mut self, i: usize, val: T)
where T: UnderlierWithBitOps, Self: From<T>,

Sets the subvalue in the given position. Function panics in case when index is out of range.

§Safety

i must be less than Self::BITS/T::BITS.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl UnderlierWithBitOps for u8

source§

const ZERO: Self = 0u8

source§

const ONE: Self = 1u8

source§

const ONES: Self = 255u8

source§

fn fill_with_bit(val: u8) -> Self

source§

impl UnderlierWithBitOps for u16

source§

const ZERO: Self = 0u16

source§

const ONE: Self = 1u16

source§

const ONES: Self = 65_535u16

source§

fn fill_with_bit(val: u8) -> Self

source§

impl UnderlierWithBitOps for u32

source§

const ZERO: Self = 0u32

source§

const ONE: Self = 1u32

source§

const ONES: Self = 4_294_967_295u32

source§

fn fill_with_bit(val: u8) -> Self

source§

impl UnderlierWithBitOps for u64

source§

const ZERO: Self = 0u64

source§

const ONE: Self = 1u64

source§

const ONES: Self = 18_446_744_073_709_551_615u64

source§

fn fill_with_bit(val: u8) -> Self

source§

impl UnderlierWithBitOps for u128

source§

const ZERO: Self = 0u128

source§

const ONE: Self = 1u128

source§

const ONES: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

source§

fn fill_with_bit(val: u8) -> Self

Implementors§

source§

impl<const N: usize> UnderlierWithBitOps for SmallU<N>

source§

const ZERO: Self = _

source§

const ONE: Self = _

source§

const ONES: Self = _