BitVec

Struct BitVec 

Source
pub struct BitVec<const N: u64>(/* private fields */);
Expand description

A fixed-size bit vector type.

BitVec<N> is a specification-friendly, fixed-length bit vector that internally stores an array of Bit values, where each Bit represents a single binary digit (0 or 1).

This type provides several utility methods for constructing and converting bit vectors:

The Debug implementation for BitVec pretty-prints the bits in groups of eight, making the bit pattern more human-readable. The type also implements indexing, allowing for easy access to individual bits.

Implementations§

Source§

impl BitVec<256>

Source

pub fn from_i32x8(iv: i32x8) -> BitVec<256>

Conversion from i32 vectors of size 8to bit vectors of size 256

Source

pub fn to_i32x8(bv: BitVec<256>) -> i32x8

Conversion from bit vectors of size 256 to i32 vectors of size 8

Source§

impl BitVec<256>

Source

pub fn from_i64x4(iv: i64x4) -> BitVec<256>

Conversion from i64 vectors of size 4to bit vectors of size 256

Source

pub fn to_i64x4(bv: BitVec<256>) -> i64x4

Conversion from bit vectors of size 256 to i64 vectors of size 4

Source§

impl BitVec<256>

Source

pub fn from_i16x16(iv: i16x16) -> BitVec<256>

Conversion from i16 vectors of size 16to bit vectors of size 256

Source

pub fn to_i16x16(bv: BitVec<256>) -> i16x16

Conversion from bit vectors of size 256 to i16 vectors of size 16

Source§

impl BitVec<256>

Source

pub fn from_i128x2(iv: i128x2) -> BitVec<256>

Conversion from i128 vectors of size 2to bit vectors of size 256

Source

pub fn to_i128x2(bv: BitVec<256>) -> i128x2

Conversion from bit vectors of size 256 to i128 vectors of size 2

Source§

impl BitVec<256>

Source

pub fn from_i8x32(iv: i8x32) -> BitVec<256>

Conversion from i8 vectors of size 32to bit vectors of size 256

Source

pub fn to_i8x32(bv: BitVec<256>) -> i8x32

Conversion from bit vectors of size 256 to i8 vectors of size 32

Source§

impl BitVec<256>

Source

pub fn from_u32x8(iv: u32x8) -> BitVec<256>

Conversion from u32 vectors of size 8to bit vectors of size 256

Source

pub fn to_u32x8(bv: BitVec<256>) -> u32x8

Conversion from bit vectors of size 256 to u32 vectors of size 8

Source§

impl BitVec<256>

Source

pub fn from_u64x4(iv: u64x4) -> BitVec<256>

Conversion from u64 vectors of size 4to bit vectors of size 256

Source

pub fn to_u64x4(bv: BitVec<256>) -> u64x4

Conversion from bit vectors of size 256 to u64 vectors of size 4

Source§

impl BitVec<256>

Source

pub fn from_u16x16(iv: u16x16) -> BitVec<256>

Conversion from u16 vectors of size 16to bit vectors of size 256

Source

pub fn to_u16x16(bv: BitVec<256>) -> u16x16

Conversion from bit vectors of size 256 to u16 vectors of size 16

Source§

impl BitVec<128>

Source

pub fn from_i32x4(iv: i32x4) -> BitVec<128>

Conversion from i32 vectors of size 4to bit vectors of size 128

Source

pub fn to_i32x4(bv: BitVec<128>) -> i32x4

Conversion from bit vectors of size 128 to i32 vectors of size 4

Source§

impl BitVec<128>

Source

pub fn from_i64x2(iv: i64x2) -> BitVec<128>

Conversion from i64 vectors of size 2to bit vectors of size 128

Source

pub fn to_i64x2(bv: BitVec<128>) -> i64x2

Conversion from bit vectors of size 128 to i64 vectors of size 2

Source§

impl BitVec<128>

Source

pub fn from_i16x8(iv: i16x8) -> BitVec<128>

Conversion from i16 vectors of size 8to bit vectors of size 128

Source

pub fn to_i16x8(bv: BitVec<128>) -> i16x8

Conversion from bit vectors of size 128 to i16 vectors of size 8

Source§

impl BitVec<128>

Source

pub fn from_i128x1(iv: i128x1) -> BitVec<128>

Conversion from i128 vectors of size 1to bit vectors of size 128

Source

pub fn to_i128x1(bv: BitVec<128>) -> i128x1

Conversion from bit vectors of size 128 to i128 vectors of size 1

Source§

impl BitVec<128>

Source

pub fn from_i8x16(iv: i8x16) -> BitVec<128>

Conversion from i8 vectors of size 16to bit vectors of size 128

Source

pub fn to_i8x16(bv: BitVec<128>) -> i8x16

Conversion from bit vectors of size 128 to i8 vectors of size 16

Source§

impl BitVec<128>

Source

pub fn from_u32x4(iv: u32x4) -> BitVec<128>

Conversion from u32 vectors of size 4to bit vectors of size 128

Source

pub fn to_u32x4(bv: BitVec<128>) -> u32x4

Conversion from bit vectors of size 128 to u32 vectors of size 4

Source§

impl BitVec<128>

Source

pub fn from_u64x2(iv: u64x2) -> BitVec<128>

Conversion from u64 vectors of size 2to bit vectors of size 128

Source

pub fn to_u64x2(bv: BitVec<128>) -> u64x2

Conversion from bit vectors of size 128 to u64 vectors of size 2

Source§

impl BitVec<128>

Source

pub fn from_u16x8(iv: u16x8) -> BitVec<128>

Conversion from u16 vectors of size 8to bit vectors of size 128

Source

pub fn to_u16x8(bv: BitVec<128>) -> u16x8

Conversion from bit vectors of size 128 to u16 vectors of size 8

Source§

impl BitVec<128>

Source

pub fn pointwise(self) -> Self

Source§

impl BitVec<256>

Source

pub fn pointwise(self) -> Self

Source§

impl<const N: u64> BitVec<N>

Source

pub fn from_fn<F: Fn(u64) -> Bit>(f: F) -> Self

Constructor for BitVec. BitVec::<N>::from_fn constructs a bitvector out of a function that takes usizes smaller than N and produces bits.

Source

pub fn from_slice<T: Into<i128> + MachineInteger + Copy>( x: &[T], d: u64, ) -> Self

Convert a slice of machine integers where only the d least significant bits are relevant.

Source

pub fn from_int<T: Into<i128> + MachineInteger + Copy>(n: T) -> Self

Construct a BitVec out of a machine integer.

Source

pub fn to_int<T: TryFrom<i128> + MachineInteger + Copy>(self) -> T

Convert a BitVec into a machine integer of type T.

Source

pub fn to_vec<T: TryFrom<i128> + MachineInteger + Copy>(&self) -> Vec<T>

Convert a BitVec into a vector of machine integers of type T.

Source

pub fn rand() -> Self

Generate a random BitVec.

Source§

impl<const N: u64> BitVec<N>

Source

pub fn chunked_shift<const CHUNK: u64, const SHIFTS: u64>( self, shl: FunArray<SHIFTS, i128>, ) -> BitVec<N>

Source

pub fn fold<A>(&self, init: A, f: fn(A, Bit) -> A) -> A

Folds over the array, accumulating a result.

§Arguments
  • init - The initial value of the accumulator.
  • f - A function combining the accumulator and each element.

Trait Implementations§

Source§

impl<const N: u64> Clone for BitVec<N>

Source§

fn clone(&self) -> BitVec<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: u64> Debug for BitVec<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<BitVec<128>> for __m128i

Source§

fn from(bv: BitVec<128>) -> __m128i

Converts to this type from the input type.
Source§

impl From<BitVec<256>> for __m256

Source§

fn from(bv: BitVec<256>) -> __m256

Converts to this type from the input type.
Source§

impl From<BitVec<256>> for __m256i

Source§

fn from(bv: BitVec<256>) -> __m256i

Converts to this type from the input type.
Source§

impl From<__m128i> for BitVec<128>

Source§

fn from(vec: __m128i) -> BitVec<128>

Converts to this type from the input type.
Source§

impl From<__m256> for BitVec<256>

Source§

fn from(vec: __m256) -> BitVec<256>

Converts to this type from the input type.
Source§

impl From<__m256i> for BitVec<256>

Source§

fn from(vec: __m256i) -> BitVec<256>

Converts to this type from the input type.
Source§

impl<const N: u64> Index<u64> for BitVec<N>

Source§

type Output = Bit

The returned type after indexing.
Source§

fn index(&self, index: u64) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<const N: u64> PartialEq for BitVec<N>

Source§

fn eq(&self, other: &BitVec<N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: u64> Copy for BitVec<N>

Source§

impl<const N: u64> Eq for BitVec<N>

Source§

impl<const N: u64> StructuralPartialEq for BitVec<N>

Auto Trait Implementations§

§

impl<const N: u64> Freeze for BitVec<N>

§

impl<const N: u64> RefUnwindSafe for BitVec<N>

§

impl<const N: u64> Send for BitVec<N>

§

impl<const N: u64> Sync for BitVec<N>

§

impl<const N: u64> Unpin for BitVec<N>

§

impl<const N: u64> UnwindSafe for BitVec<N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V