Struct U8x32

Source
pub struct U8x32(/* private fields */);
Expand description

[u8; 32] as a vector.

Implementations§

Source§

impl U8x32

Source

pub const fn from_array(arr: [u8; 32]) -> Self

Create a vector from an array.

Unlike the From trait function, the from_array function is const.

§Example
const MY_EXTREMELY_FUN_VALUE: U8x32 = U8x32::from_array([
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
    23, 24, 25, 26, 27, 28, 29, 30, 31,
]);
for (i, value) in MY_EXTREMELY_FUN_VALUE.as_array().iter().copied().enumerate() {
    assert_eq!(i as u8, value);
}
Source§

impl U8x32

Source

pub fn shuffle(&self, order: U8x32) -> U8x32

§Scalar Equivalent:
let mut arr = [0; 32];
for (lane_dst, (lane_src, order)) in
    arr.chunks_exact_mut(16).zip(
        self.as_array().chunks_exact(16)
        .zip(order.as_array().chunks_exact(16))
    )
{
    for (dst, idx) in lane_dst.iter_mut().zip(order) {
        let idx = *idx;
        *dst = if (idx >> 7) == 1 {
            0
        } else {
            lane_src[(idx as usize) % 16]
        };
    }
}
arr.into()
§Avx2

Trait Implementations§

Source§

impl Add for U8x32

Source§

fn add(self, rhs: U8x32) -> U8x32

Perform a pairwise wrapping_add

§Scalar Equivalent
U8x32::from([
    self.as_array()[0].wrapping_add(rhs.as_array()[0]),
    self.as_array()[1].wrapping_add(rhs.as_array()[1]),
    self.as_array()[2].wrapping_add(rhs.as_array()[2]),
    self.as_array()[3].wrapping_add(rhs.as_array()[3]),
    self.as_array()[4].wrapping_add(rhs.as_array()[4]),
    self.as_array()[5].wrapping_add(rhs.as_array()[5]),
    self.as_array()[6].wrapping_add(rhs.as_array()[6]),
    self.as_array()[7].wrapping_add(rhs.as_array()[7]),
    self.as_array()[8].wrapping_add(rhs.as_array()[8]),
    self.as_array()[9].wrapping_add(rhs.as_array()[9]),
    self.as_array()[10].wrapping_add(rhs.as_array()[10]),
    self.as_array()[11].wrapping_add(rhs.as_array()[11]),
    self.as_array()[12].wrapping_add(rhs.as_array()[12]),
    self.as_array()[13].wrapping_add(rhs.as_array()[13]),
    self.as_array()[14].wrapping_add(rhs.as_array()[14]),
    self.as_array()[15].wrapping_add(rhs.as_array()[15]),
    self.as_array()[16].wrapping_add(rhs.as_array()[16]),
    self.as_array()[17].wrapping_add(rhs.as_array()[17]),
    self.as_array()[18].wrapping_add(rhs.as_array()[18]),
    self.as_array()[19].wrapping_add(rhs.as_array()[19]),
    self.as_array()[20].wrapping_add(rhs.as_array()[20]),
    self.as_array()[21].wrapping_add(rhs.as_array()[21]),
    self.as_array()[22].wrapping_add(rhs.as_array()[22]),
    self.as_array()[23].wrapping_add(rhs.as_array()[23]),
    self.as_array()[24].wrapping_add(rhs.as_array()[24]),
    self.as_array()[25].wrapping_add(rhs.as_array()[25]),
    self.as_array()[26].wrapping_add(rhs.as_array()[26]),
    self.as_array()[27].wrapping_add(rhs.as_array()[27]),
    self.as_array()[28].wrapping_add(rhs.as_array()[28]),
    self.as_array()[29].wrapping_add(rhs.as_array()[29]),
    self.as_array()[30].wrapping_add(rhs.as_array()[30]),
    self.as_array()[31].wrapping_add(rhs.as_array()[31]),
])
§AVX2 Intrinsics Used
§Neon Intrinsics Used
Source§

type Output = U8x32

The resulting type after applying the + operator.
Source§

impl AddAssign for U8x32

Source§

fn add_assign(&mut self, other: U8x32)

Performs the += operation. Read more
Source§

impl AsMut<[u8]> for U8x32

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[u8]> for U8x32

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl BitAnd for U8x32

Source§

fn bitand(self, rhs: U8x32) -> U8x32

Perform a pairwise bitwise and

§Scalar Equivalent
U8x32::from([
    self.as_array()[0] & rhs.as_array()[0],
    self.as_array()[1] & rhs.as_array()[1],
    self.as_array()[2] & rhs.as_array()[2],
    self.as_array()[3] & rhs.as_array()[3],
    self.as_array()[4] & rhs.as_array()[4],
    self.as_array()[5] & rhs.as_array()[5],
    self.as_array()[6] & rhs.as_array()[6],
    self.as_array()[7] & rhs.as_array()[7],
    self.as_array()[8] & rhs.as_array()[8],
    self.as_array()[9] & rhs.as_array()[9],
    self.as_array()[10] & rhs.as_array()[10],
    self.as_array()[11] & rhs.as_array()[11],
    self.as_array()[12] & rhs.as_array()[12],
    self.as_array()[13] & rhs.as_array()[13],
    self.as_array()[14] & rhs.as_array()[14],
    self.as_array()[15] & rhs.as_array()[15],
    self.as_array()[16] & rhs.as_array()[16],
    self.as_array()[17] & rhs.as_array()[17],
    self.as_array()[18] & rhs.as_array()[18],
    self.as_array()[19] & rhs.as_array()[19],
    self.as_array()[20] & rhs.as_array()[20],
    self.as_array()[21] & rhs.as_array()[21],
    self.as_array()[22] & rhs.as_array()[22],
    self.as_array()[23] & rhs.as_array()[23],
    self.as_array()[24] & rhs.as_array()[24],
    self.as_array()[25] & rhs.as_array()[25],
    self.as_array()[26] & rhs.as_array()[26],
    self.as_array()[27] & rhs.as_array()[27],
    self.as_array()[28] & rhs.as_array()[28],
    self.as_array()[29] & rhs.as_array()[29],
    self.as_array()[30] & rhs.as_array()[30],
    self.as_array()[31] & rhs.as_array()[31],
])
§AVX2 Intrinsics Used
§Neon Intrinsics Used
Source§

type Output = U8x32

The resulting type after applying the & operator.
Source§

impl BitAndAssign for U8x32

Source§

fn bitand_assign(&mut self, other: U8x32)

Performs the &= operation. Read more
Source§

impl BitOr for U8x32

Source§

fn bitor(self, rhs: U8x32) -> U8x32

Perform a pairwise bitwise or

§Scalar Equivalent
U8x32::from([
    self.as_array()[0] | rhs.as_array()[0],
    self.as_array()[1] | rhs.as_array()[1],
    self.as_array()[2] | rhs.as_array()[2],
    self.as_array()[3] | rhs.as_array()[3],
    self.as_array()[4] | rhs.as_array()[4],
    self.as_array()[5] | rhs.as_array()[5],
    self.as_array()[6] | rhs.as_array()[6],
    self.as_array()[7] | rhs.as_array()[7],
    self.as_array()[8] | rhs.as_array()[8],
    self.as_array()[9] | rhs.as_array()[9],
    self.as_array()[10] | rhs.as_array()[10],
    self.as_array()[11] | rhs.as_array()[11],
    self.as_array()[12] | rhs.as_array()[12],
    self.as_array()[13] | rhs.as_array()[13],
    self.as_array()[14] | rhs.as_array()[14],
    self.as_array()[15] | rhs.as_array()[15],
    self.as_array()[16] | rhs.as_array()[16],
    self.as_array()[17] | rhs.as_array()[17],
    self.as_array()[18] | rhs.as_array()[18],
    self.as_array()[19] | rhs.as_array()[19],
    self.as_array()[20] | rhs.as_array()[20],
    self.as_array()[21] | rhs.as_array()[21],
    self.as_array()[22] | rhs.as_array()[22],
    self.as_array()[23] | rhs.as_array()[23],
    self.as_array()[24] | rhs.as_array()[24],
    self.as_array()[25] | rhs.as_array()[25],
    self.as_array()[26] | rhs.as_array()[26],
    self.as_array()[27] | rhs.as_array()[27],
    self.as_array()[28] | rhs.as_array()[28],
    self.as_array()[29] | rhs.as_array()[29],
    self.as_array()[30] | rhs.as_array()[30],
    self.as_array()[31] | rhs.as_array()[31],
])
§AVX2 Intrinsics Used
§Neon Intrinsics Used
Source§

type Output = U8x32

The resulting type after applying the | operator.
Source§

impl BitOrAssign for U8x32

Source§

fn bitor_assign(&mut self, other: U8x32)

Performs the |= operation. Read more
Source§

impl BitXor for U8x32

Source§

fn bitxor(self, rhs: U8x32) -> U8x32

Perform a pairwise bitwise xor

§Scalar Equivalent
U8x32::from([
    self.as_array()[0] ^ rhs.as_array()[0],
    self.as_array()[1] ^ rhs.as_array()[1],
    self.as_array()[2] ^ rhs.as_array()[2],
    self.as_array()[3] ^ rhs.as_array()[3],
    self.as_array()[4] ^ rhs.as_array()[4],
    self.as_array()[5] ^ rhs.as_array()[5],
    self.as_array()[6] ^ rhs.as_array()[6],
    self.as_array()[7] ^ rhs.as_array()[7],
    self.as_array()[8] ^ rhs.as_array()[8],
    self.as_array()[9] ^ rhs.as_array()[9],
    self.as_array()[10] ^ rhs.as_array()[10],
    self.as_array()[11] ^ rhs.as_array()[11],
    self.as_array()[12] ^ rhs.as_array()[12],
    self.as_array()[13] ^ rhs.as_array()[13],
    self.as_array()[14] ^ rhs.as_array()[14],
    self.as_array()[15] ^ rhs.as_array()[15],
    self.as_array()[16] ^ rhs.as_array()[16],
    self.as_array()[17] ^ rhs.as_array()[17],
    self.as_array()[18] ^ rhs.as_array()[18],
    self.as_array()[19] ^ rhs.as_array()[19],
    self.as_array()[20] ^ rhs.as_array()[20],
    self.as_array()[21] ^ rhs.as_array()[21],
    self.as_array()[22] ^ rhs.as_array()[22],
    self.as_array()[23] ^ rhs.as_array()[23],
    self.as_array()[24] ^ rhs.as_array()[24],
    self.as_array()[25] ^ rhs.as_array()[25],
    self.as_array()[26] ^ rhs.as_array()[26],
    self.as_array()[27] ^ rhs.as_array()[27],
    self.as_array()[28] ^ rhs.as_array()[28],
    self.as_array()[29] ^ rhs.as_array()[29],
    self.as_array()[30] ^ rhs.as_array()[30],
    self.as_array()[31] ^ rhs.as_array()[31],
])
§AVX2 Intrinsics Used
§Neon Intrinsics Used
Source§

type Output = U8x32

The resulting type after applying the ^ operator.
Source§

impl BitXorAssign for U8x32

Source§

fn bitxor_assign(&mut self, other: U8x32)

Performs the ^= operation. Read more
Source§

impl Clone for U8x32

Source§

fn clone(&self) -> U8x32

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 ConditionallySelectable for U8x32

Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

impl ConstantTimeEq for U8x32

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl Debug for U8x32

Source§

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

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

impl Default for U8x32

Source§

fn default() -> Self

The zero vector.

Source§

impl<'de> Deserialize<'de> for U8x32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Distribution<U8x32> for Standard

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> U8x32

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

impl From<[U8x16; 2]> for U8x32

Source§

fn from(vectors: [U8x16; 2]) -> U8x32

§Scalar Equivalent:
let mut out = [0; 32];
out[0..16].copy_from_slice(&vectors[0].as_array());
out[16..].copy_from_slice(&vectors[1].as_array());
U8x32::from(out)
§Avx2
Source§

impl From<[u8; 32]> for U8x32

Source§

fn from(arr: [u8; 32]) -> U8x32

Converts to this type from the input type.
Source§

impl From<I16x16> for U8x32

Source§

fn from(x: I16x16) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of I16x16 as little endian bits of U8x32.

Source§

impl From<I32x8> for U8x32

Source§

fn from(x: I32x8) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of I32x8 as little endian bits of U8x32.

Source§

impl From<I64x4> for U8x32

Source§

fn from(x: I64x4) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of I64x4 as little endian bits of U8x32.

Source§

impl From<I8x32> for U8x32

Source§

fn from(x: I8x32) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of I8x32 as little endian bits of U8x32.

Source§

impl From<U16x16> for U8x32

Source§

fn from(x: U16x16) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of U16x16 as little endian bits of U8x32.

Source§

impl From<U32x8> for U8x32

Source§

fn from(x: U32x8) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of U32x8 as little endian bits of U8x32.

Source§

impl From<U64x4> for U8x32

Source§

fn from(x: U64x4) -> U8x32

This cast is 100% free. It reinterprets the little-endinan bits of U64x4 as little endian bits of U8x32.

Source§

impl From<U8x16> for U8x32

Source§

fn from(vector: U8x16) -> U8x32

NOTE: this will zero the upper bits of the destination. Other intrinsics are more effcient, but leave the upper bits undefined. At present, these more effcient intrinsics are not exposed.

§Scalar Equivalent:
let mut out = [0; 32];
out[0..16].copy_from_slice(&vector.as_array());
U8x32::from(out)
§Avx2
Source§

impl From<U8x32> for [U8x16; 2]

Source§

fn from(vector: U8x32) -> [U8x16; 2]

§Scalar Equivalent:
let mut lo = [0; 16];
let mut hi = [0; 16];
lo.copy_from_slice(&vector.as_array()[0..16]);
hi.copy_from_slice(&vector.as_array()[16..]);
[U8x16::from(lo), U8x16::from(hi)]
§Avx2
Source§

impl From<U8x32> for [u8; 32]

Source§

fn from(arr: U8x32) -> [u8; 32]

Converts to this type from the input type.
Source§

impl From<U8x32> for I16x16

Source§

fn from(x: U8x32) -> I16x16

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of I16x16.

Source§

impl From<U8x32> for I32x8

Source§

fn from(x: U8x32) -> I32x8

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of I32x8.

Source§

impl From<U8x32> for I64x4

Source§

fn from(x: U8x32) -> I64x4

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of I64x4.

Source§

impl From<U8x32> for I8x32

Source§

fn from(x: U8x32) -> I8x32

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of I8x32.

Source§

impl From<U8x32> for U16x16

Source§

fn from(x: U8x32) -> U16x16

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of U16x16.

Source§

impl From<U8x32> for U32x8

Source§

fn from(x: U8x32) -> U32x8

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of U32x8.

Source§

impl From<U8x32> for U64x4

Source§

fn from(x: U8x32) -> U64x4

This cast is 100% free. It reinterprets the little-endinan bits of U8x32 as little endian bits of U64x4.

Source§

impl Hash for U8x32

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for U8x32

Source§

fn eq(&self, other: &Self) -> 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 Serialize for U8x32

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Shl<u64> for U8x32

Source§

fn shl(self, amount: u64) -> U8x32

§Scalar Equivalent:
if amount >= 8 {
    U8x32::ZERO
} else {
    U8x32::from([
        self.as_array()[0] << amount,
        self.as_array()[1] << amount,
        self.as_array()[2] << amount,
        self.as_array()[3] << amount,
        self.as_array()[4] << amount,
        self.as_array()[5] << amount,
        self.as_array()[6] << amount,
        self.as_array()[7] << amount,
        self.as_array()[8] << amount,
        self.as_array()[9] << amount,
        self.as_array()[10] << amount,
        self.as_array()[11] << amount,
        self.as_array()[12] << amount,
        self.as_array()[13] << amount,
        self.as_array()[14] << amount,
        self.as_array()[15] << amount,
        self.as_array()[16] << amount,
        self.as_array()[17] << amount,
        self.as_array()[18] << amount,
        self.as_array()[19] << amount,
        self.as_array()[20] << amount,
        self.as_array()[21] << amount,
        self.as_array()[22] << amount,
        self.as_array()[23] << amount,
        self.as_array()[24] << amount,
        self.as_array()[25] << amount,
        self.as_array()[26] << amount,
        self.as_array()[27] << amount,
        self.as_array()[28] << amount,
        self.as_array()[29] << amount,
        self.as_array()[30] << amount,
        self.as_array()[31] << amount,
    ])
}
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

type Output = U8x32

The resulting type after applying the << operator.
Source§

impl Shl for U8x32

Source§

fn shl(self, amount: U8x32) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {
    *x = if (0..8).contains(&amm) {
        *x << amm
    }  else {
        0
    };
}
U8x32::from(out)
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

type Output = U8x32

The resulting type after applying the << operator.
Source§

impl ShlAssign<u64> for U8x32

Source§

fn shl_assign(&mut self, amount: u64)

Performs the <<= operation. Read more
Source§

impl ShlAssign for U8x32

Source§

fn shl_assign(&mut self, amount: U8x32)

Performs the <<= operation. Read more
Source§

impl Shr<u64> for U8x32

Source§

fn shr(self, amount: u64) -> U8x32

§Scalar Equivalent:
if amount >= 8 {
    U8x32::ZERO
} else {
    U8x32::from([
        self.as_array()[0] >> amount,
        self.as_array()[1] >> amount,
        self.as_array()[2] >> amount,
        self.as_array()[3] >> amount,
        self.as_array()[4] >> amount,
        self.as_array()[5] >> amount,
        self.as_array()[6] >> amount,
        self.as_array()[7] >> amount,
        self.as_array()[8] >> amount,
        self.as_array()[9] >> amount,
        self.as_array()[10] >> amount,
        self.as_array()[11] >> amount,
        self.as_array()[12] >> amount,
        self.as_array()[13] >> amount,
        self.as_array()[14] >> amount,
        self.as_array()[15] >> amount,
        self.as_array()[16] >> amount,
        self.as_array()[17] >> amount,
        self.as_array()[18] >> amount,
        self.as_array()[19] >> amount,
        self.as_array()[20] >> amount,
        self.as_array()[21] >> amount,
        self.as_array()[22] >> amount,
        self.as_array()[23] >> amount,
        self.as_array()[24] >> amount,
        self.as_array()[25] >> amount,
        self.as_array()[26] >> amount,
        self.as_array()[27] >> amount,
        self.as_array()[28] >> amount,
        self.as_array()[29] >> amount,
        self.as_array()[30] >> amount,
        self.as_array()[31] >> amount,
    ])
}
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

type Output = U8x32

The resulting type after applying the >> operator.
Source§

impl Shr for U8x32

Source§

fn shr(self, amount: U8x32) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for (x, amm) in out.iter_mut().zip(amount.as_array().iter().copied()) {
    *x = if (0..8).contains(&amm) {
        *x >> amm
    }  else {
        0
    };
}
U8x32::from(out)
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

type Output = U8x32

The resulting type after applying the >> operator.
Source§

impl ShrAssign<u64> for U8x32

Source§

fn shr_assign(&mut self, amount: u64)

Performs the >>= operation. Read more
Source§

impl ShrAssign for U8x32

Source§

fn shr_assign(&mut self, amount: U8x32)

Performs the >>= operation. Read more
Source§

impl SimdBase for U8x32

Source§

fn is_zero(&self) -> bool

§Scalar Equivalent:
self.as_array().iter().all(|x| *x == 0)
§Avx2
Source§

fn set_lo(scalar: u8) -> U8x32

§Scalar Equivalent:
let mut out = [0; 32];
out[0] = scalar;
U8x32::from(out)
§Avx2
Source§

fn extract<const I: usize>(&self) -> u8

§Scalar Equivalent:
self.as_array()[I]
§Avx2
Source§

fn broadcast(scalar: u8) -> U8x32

§Scalar Equivalent:
U8x32::from([scalar; 32])
§Avx2
Source§

fn broadcast_lo(vector: U8x16) -> U8x32

§Scalar Equivalent:
U8x32::from([vector.as_array()[0]; 32])
§Avx2
Source§

fn cmp_eq(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    if self.as_array()[0] == other.as_array()[0] {  u8::MAX  } else { 0 },
    if self.as_array()[1] == other.as_array()[1] {  u8::MAX  } else { 0 },
    if self.as_array()[2] == other.as_array()[2] {  u8::MAX  } else { 0 },
    if self.as_array()[3] == other.as_array()[3] {  u8::MAX  } else { 0 },
    if self.as_array()[4] == other.as_array()[4] {  u8::MAX  } else { 0 },
    if self.as_array()[5] == other.as_array()[5] {  u8::MAX  } else { 0 },
    if self.as_array()[6] == other.as_array()[6] {  u8::MAX  } else { 0 },
    if self.as_array()[7] == other.as_array()[7] {  u8::MAX  } else { 0 },
    if self.as_array()[8] == other.as_array()[8] {  u8::MAX  } else { 0 },
    if self.as_array()[9] == other.as_array()[9] {  u8::MAX  } else { 0 },
    if self.as_array()[10] == other.as_array()[10] {  u8::MAX  } else { 0 },
    if self.as_array()[11] == other.as_array()[11] {  u8::MAX  } else { 0 },
    if self.as_array()[12] == other.as_array()[12] {  u8::MAX  } else { 0 },
    if self.as_array()[13] == other.as_array()[13] {  u8::MAX  } else { 0 },
    if self.as_array()[14] == other.as_array()[14] {  u8::MAX  } else { 0 },
    if self.as_array()[15] == other.as_array()[15] {  u8::MAX  } else { 0 },
    if self.as_array()[16] == other.as_array()[16] {  u8::MAX  } else { 0 },
    if self.as_array()[17] == other.as_array()[17] {  u8::MAX  } else { 0 },
    if self.as_array()[18] == other.as_array()[18] {  u8::MAX  } else { 0 },
    if self.as_array()[19] == other.as_array()[19] {  u8::MAX  } else { 0 },
    if self.as_array()[20] == other.as_array()[20] {  u8::MAX  } else { 0 },
    if self.as_array()[21] == other.as_array()[21] {  u8::MAX  } else { 0 },
    if self.as_array()[22] == other.as_array()[22] {  u8::MAX  } else { 0 },
    if self.as_array()[23] == other.as_array()[23] {  u8::MAX  } else { 0 },
    if self.as_array()[24] == other.as_array()[24] {  u8::MAX  } else { 0 },
    if self.as_array()[25] == other.as_array()[25] {  u8::MAX  } else { 0 },
    if self.as_array()[26] == other.as_array()[26] {  u8::MAX  } else { 0 },
    if self.as_array()[27] == other.as_array()[27] {  u8::MAX  } else { 0 },
    if self.as_array()[28] == other.as_array()[28] {  u8::MAX  } else { 0 },
    if self.as_array()[29] == other.as_array()[29] {  u8::MAX  } else { 0 },
    if self.as_array()[30] == other.as_array()[30] {  u8::MAX  } else { 0 },
    if self.as_array()[31] == other.as_array()[31] {  u8::MAX  } else { 0 },
])
§Avx2
Source§

fn and_not(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    self.as_array()[0] & (!other.as_array()[0]),
    self.as_array()[1] & (!other.as_array()[1]),
    self.as_array()[2] & (!other.as_array()[2]),
    self.as_array()[3] & (!other.as_array()[3]),
    self.as_array()[4] & (!other.as_array()[4]),
    self.as_array()[5] & (!other.as_array()[5]),
    self.as_array()[6] & (!other.as_array()[6]),
    self.as_array()[7] & (!other.as_array()[7]),
    self.as_array()[8] & (!other.as_array()[8]),
    self.as_array()[9] & (!other.as_array()[9]),
    self.as_array()[10] & (!other.as_array()[10]),
    self.as_array()[11] & (!other.as_array()[11]),
    self.as_array()[12] & (!other.as_array()[12]),
    self.as_array()[13] & (!other.as_array()[13]),
    self.as_array()[14] & (!other.as_array()[14]),
    self.as_array()[15] & (!other.as_array()[15]),
    self.as_array()[16] & (!other.as_array()[16]),
    self.as_array()[17] & (!other.as_array()[17]),
    self.as_array()[18] & (!other.as_array()[18]),
    self.as_array()[19] & (!other.as_array()[19]),
    self.as_array()[20] & (!other.as_array()[20]),
    self.as_array()[21] & (!other.as_array()[21]),
    self.as_array()[22] & (!other.as_array()[22]),
    self.as_array()[23] & (!other.as_array()[23]),
    self.as_array()[24] & (!other.as_array()[24]),
    self.as_array()[25] & (!other.as_array()[25]),
    self.as_array()[26] & (!other.as_array()[26]),
    self.as_array()[27] & (!other.as_array()[27]),
    self.as_array()[28] & (!other.as_array()[28]),
    self.as_array()[29] & (!other.as_array()[29]),
    self.as_array()[30] & (!other.as_array()[30]),
    self.as_array()[31] & (!other.as_array()[31]),
])
§Avx2
Source§

fn cmp_gt(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    if self.as_array()[0] > other.as_array()[0] {  u8::MAX  } else { 0 },
    if self.as_array()[1] > other.as_array()[1] {  u8::MAX  } else { 0 },
    if self.as_array()[2] > other.as_array()[2] {  u8::MAX  } else { 0 },
    if self.as_array()[3] > other.as_array()[3] {  u8::MAX  } else { 0 },
    if self.as_array()[4] > other.as_array()[4] {  u8::MAX  } else { 0 },
    if self.as_array()[5] > other.as_array()[5] {  u8::MAX  } else { 0 },
    if self.as_array()[6] > other.as_array()[6] {  u8::MAX  } else { 0 },
    if self.as_array()[7] > other.as_array()[7] {  u8::MAX  } else { 0 },
    if self.as_array()[8] > other.as_array()[8] {  u8::MAX  } else { 0 },
    if self.as_array()[9] > other.as_array()[9] {  u8::MAX  } else { 0 },
    if self.as_array()[10] > other.as_array()[10] {  u8::MAX  } else { 0 },
    if self.as_array()[11] > other.as_array()[11] {  u8::MAX  } else { 0 },
    if self.as_array()[12] > other.as_array()[12] {  u8::MAX  } else { 0 },
    if self.as_array()[13] > other.as_array()[13] {  u8::MAX  } else { 0 },
    if self.as_array()[14] > other.as_array()[14] {  u8::MAX  } else { 0 },
    if self.as_array()[15] > other.as_array()[15] {  u8::MAX  } else { 0 },
    if self.as_array()[16] > other.as_array()[16] {  u8::MAX  } else { 0 },
    if self.as_array()[17] > other.as_array()[17] {  u8::MAX  } else { 0 },
    if self.as_array()[18] > other.as_array()[18] {  u8::MAX  } else { 0 },
    if self.as_array()[19] > other.as_array()[19] {  u8::MAX  } else { 0 },
    if self.as_array()[20] > other.as_array()[20] {  u8::MAX  } else { 0 },
    if self.as_array()[21] > other.as_array()[21] {  u8::MAX  } else { 0 },
    if self.as_array()[22] > other.as_array()[22] {  u8::MAX  } else { 0 },
    if self.as_array()[23] > other.as_array()[23] {  u8::MAX  } else { 0 },
    if self.as_array()[24] > other.as_array()[24] {  u8::MAX  } else { 0 },
    if self.as_array()[25] > other.as_array()[25] {  u8::MAX  } else { 0 },
    if self.as_array()[26] > other.as_array()[26] {  u8::MAX  } else { 0 },
    if self.as_array()[27] > other.as_array()[27] {  u8::MAX  } else { 0 },
    if self.as_array()[28] > other.as_array()[28] {  u8::MAX  } else { 0 },
    if self.as_array()[29] > other.as_array()[29] {  u8::MAX  } else { 0 },
    if self.as_array()[30] > other.as_array()[30] {  u8::MAX  } else { 0 },
    if self.as_array()[31] > other.as_array()[31] {  u8::MAX  } else { 0 },
])
§Avx2

NOTE: this implementation uses an efficient vector polyfill, though this operation is not natively supported.

// Based on https://stackoverflow.com/a/33173643 and https://git.io/JmghK
let sign_bit = Self::broadcast(1 << 7);
Self::from(I8x32::from(*self ^ sign_bit).cmp_gt(
    I8x32::from(other ^ sign_bit)
))
Source§

fn shift_left<const BITS: usize>(&self) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for x in out.iter_mut() {
    *x <<= BITS;
}
U8x32::from(out)
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

fn shift_right<const BITS: usize>(&self) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for x in out.iter_mut() {
    *x >>= BITS;
}
U8x32::from(out)
§Avx2

WARNING: this implementation is a polyfill which executes the scalar implemenation.

Source§

fn unpack_lo(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    // Lane# 0
    self.as_array()[0],
    other.as_array()[0],
    self.as_array()[1],
    other.as_array()[1],
    self.as_array()[2],
    other.as_array()[2],
    self.as_array()[3],
    other.as_array()[3],
    self.as_array()[4],
    other.as_array()[4],
    self.as_array()[5],
    other.as_array()[5],
    self.as_array()[6],
    other.as_array()[6],
    self.as_array()[7],
    other.as_array()[7],
    // Lane# 1
    self.as_array()[16],
    other.as_array()[16],
    self.as_array()[17],
    other.as_array()[17],
    self.as_array()[18],
    other.as_array()[18],
    self.as_array()[19],
    other.as_array()[19],
    self.as_array()[20],
    other.as_array()[20],
    self.as_array()[21],
    other.as_array()[21],
    self.as_array()[22],
    other.as_array()[22],
    self.as_array()[23],
    other.as_array()[23],
])
§Avx2
Source§

fn unpack_hi(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    // Lane# 0
    self.as_array()[8],
    other.as_array()[8],
    self.as_array()[9],
    other.as_array()[9],
    self.as_array()[10],
    other.as_array()[10],
    self.as_array()[11],
    other.as_array()[11],
    self.as_array()[12],
    other.as_array()[12],
    self.as_array()[13],
    other.as_array()[13],
    self.as_array()[14],
    other.as_array()[14],
    self.as_array()[15],
    other.as_array()[15],
    // Lane# 1
    self.as_array()[24],
    other.as_array()[24],
    self.as_array()[25],
    other.as_array()[25],
    self.as_array()[26],
    other.as_array()[26],
    self.as_array()[27],
    other.as_array()[27],
    self.as_array()[28],
    other.as_array()[28],
    self.as_array()[29],
    other.as_array()[29],
    self.as_array()[30],
    other.as_array()[30],
    self.as_array()[31],
    other.as_array()[31],
])
§Avx2
Source§

fn max(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    self.as_array()[0].max(other.as_array()[0]),
    self.as_array()[1].max(other.as_array()[1]),
    self.as_array()[2].max(other.as_array()[2]),
    self.as_array()[3].max(other.as_array()[3]),
    self.as_array()[4].max(other.as_array()[4]),
    self.as_array()[5].max(other.as_array()[5]),
    self.as_array()[6].max(other.as_array()[6]),
    self.as_array()[7].max(other.as_array()[7]),
    self.as_array()[8].max(other.as_array()[8]),
    self.as_array()[9].max(other.as_array()[9]),
    self.as_array()[10].max(other.as_array()[10]),
    self.as_array()[11].max(other.as_array()[11]),
    self.as_array()[12].max(other.as_array()[12]),
    self.as_array()[13].max(other.as_array()[13]),
    self.as_array()[14].max(other.as_array()[14]),
    self.as_array()[15].max(other.as_array()[15]),
    self.as_array()[16].max(other.as_array()[16]),
    self.as_array()[17].max(other.as_array()[17]),
    self.as_array()[18].max(other.as_array()[18]),
    self.as_array()[19].max(other.as_array()[19]),
    self.as_array()[20].max(other.as_array()[20]),
    self.as_array()[21].max(other.as_array()[21]),
    self.as_array()[22].max(other.as_array()[22]),
    self.as_array()[23].max(other.as_array()[23]),
    self.as_array()[24].max(other.as_array()[24]),
    self.as_array()[25].max(other.as_array()[25]),
    self.as_array()[26].max(other.as_array()[26]),
    self.as_array()[27].max(other.as_array()[27]),
    self.as_array()[28].max(other.as_array()[28]),
    self.as_array()[29].max(other.as_array()[29]),
    self.as_array()[30].max(other.as_array()[30]),
    self.as_array()[31].max(other.as_array()[31]),
])
§Avx2
Source§

fn min(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
U8x32::from([
    self.as_array()[0].min(other.as_array()[0]),
    self.as_array()[1].min(other.as_array()[1]),
    self.as_array()[2].min(other.as_array()[2]),
    self.as_array()[3].min(other.as_array()[3]),
    self.as_array()[4].min(other.as_array()[4]),
    self.as_array()[5].min(other.as_array()[5]),
    self.as_array()[6].min(other.as_array()[6]),
    self.as_array()[7].min(other.as_array()[7]),
    self.as_array()[8].min(other.as_array()[8]),
    self.as_array()[9].min(other.as_array()[9]),
    self.as_array()[10].min(other.as_array()[10]),
    self.as_array()[11].min(other.as_array()[11]),
    self.as_array()[12].min(other.as_array()[12]),
    self.as_array()[13].min(other.as_array()[13]),
    self.as_array()[14].min(other.as_array()[14]),
    self.as_array()[15].min(other.as_array()[15]),
    self.as_array()[16].min(other.as_array()[16]),
    self.as_array()[17].min(other.as_array()[17]),
    self.as_array()[18].min(other.as_array()[18]),
    self.as_array()[19].min(other.as_array()[19]),
    self.as_array()[20].min(other.as_array()[20]),
    self.as_array()[21].min(other.as_array()[21]),
    self.as_array()[22].min(other.as_array()[22]),
    self.as_array()[23].min(other.as_array()[23]),
    self.as_array()[24].min(other.as_array()[24]),
    self.as_array()[25].min(other.as_array()[25]),
    self.as_array()[26].min(other.as_array()[26]),
    self.as_array()[27].min(other.as_array()[27]),
    self.as_array()[28].min(other.as_array()[28]),
    self.as_array()[29].min(other.as_array()[29]),
    self.as_array()[30].min(other.as_array()[30]),
    self.as_array()[31].min(other.as_array()[31]),
])
§Avx2
Source§

const LANES: usize = 32usize

The number of elements of this vector.
Source§

const ZERO: Self

A vector where every element is zero.
Source§

type Scalar = u8

The scalar that this value holds.
Source§

type Array = [u8; 32]

The equivalent array type of this vector.
Source§

type Signed = I8x32

The signed version of this vector.
Source§

type Unsigned = U8x32

The unsigned version of this vector.
Source§

type BroadcastLoInput = U8x16

A vector of [Self::Scalar; 128 / (8 * std::mem::size_of::<Self::Scalar>())]
Source§

fn as_array(&self) -> Self::Array

Convert the vector to an array.
Source§

impl SimdBase8 for U8x32

Source§

fn shift_bytes_left<const AMOUNT: usize>(&self) -> U8x32

§Scalar Equivalent:
let mut out = [0; 32];
for (out_lane, src_lane) in out
    .chunks_exact_mut(16)
    .zip(self.as_array().chunks_exact(16))
{
    out_lane[AMOUNT..].copy_from_slice(&src_lane[0..16 - AMOUNT]);
}
U8x32::from(out)
§Avx2
Source§

fn shift_bytes_right<const AMOUNT: usize>(&self) -> U8x32

§Scalar Equivalent:
let mut out = [0; 32];
for (out_lane, src_lane) in out
    .chunks_exact_mut(16)
    .zip(self.as_array().chunks_exact(16))
{
    out_lane[0..16 - AMOUNT].copy_from_slice(&src_lane[AMOUNT..]);
}
U8x32::from(out)
§Avx2
Source§

fn most_significant_bits(&self) -> u32

§Scalar Equivalent:
let mut out: u32 = 0;
for (i, value) in self.as_array().iter().copied().enumerate() {
    out |= u32::from((value as u8) >> 7) << i;
}
out
§Avx2
Source§

impl SimdSaturatingArithmetic for U8x32

Source§

fn saturating_add(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {
    *dst = dst.saturating_add(*src);
}
Self::from(out)
§Avx2
Source§

fn saturating_sub(&self, other: U8x32) -> U8x32

§Scalar Equivalent:
let mut out = self.as_array();
for (dst, src) in out.iter_mut().zip(other.as_array().iter()) {
    *dst = dst.saturating_sub(*src);
}
Self::from(out)
§Avx2
Source§

impl Sub for U8x32

Source§

fn sub(self, rhs: U8x32) -> U8x32

Perform a pairwise wrapping_sub

§Scalar Equivalent
U8x32::from([
    self.as_array()[0].wrapping_sub(rhs.as_array()[0]),
    self.as_array()[1].wrapping_sub(rhs.as_array()[1]),
    self.as_array()[2].wrapping_sub(rhs.as_array()[2]),
    self.as_array()[3].wrapping_sub(rhs.as_array()[3]),
    self.as_array()[4].wrapping_sub(rhs.as_array()[4]),
    self.as_array()[5].wrapping_sub(rhs.as_array()[5]),
    self.as_array()[6].wrapping_sub(rhs.as_array()[6]),
    self.as_array()[7].wrapping_sub(rhs.as_array()[7]),
    self.as_array()[8].wrapping_sub(rhs.as_array()[8]),
    self.as_array()[9].wrapping_sub(rhs.as_array()[9]),
    self.as_array()[10].wrapping_sub(rhs.as_array()[10]),
    self.as_array()[11].wrapping_sub(rhs.as_array()[11]),
    self.as_array()[12].wrapping_sub(rhs.as_array()[12]),
    self.as_array()[13].wrapping_sub(rhs.as_array()[13]),
    self.as_array()[14].wrapping_sub(rhs.as_array()[14]),
    self.as_array()[15].wrapping_sub(rhs.as_array()[15]),
    self.as_array()[16].wrapping_sub(rhs.as_array()[16]),
    self.as_array()[17].wrapping_sub(rhs.as_array()[17]),
    self.as_array()[18].wrapping_sub(rhs.as_array()[18]),
    self.as_array()[19].wrapping_sub(rhs.as_array()[19]),
    self.as_array()[20].wrapping_sub(rhs.as_array()[20]),
    self.as_array()[21].wrapping_sub(rhs.as_array()[21]),
    self.as_array()[22].wrapping_sub(rhs.as_array()[22]),
    self.as_array()[23].wrapping_sub(rhs.as_array()[23]),
    self.as_array()[24].wrapping_sub(rhs.as_array()[24]),
    self.as_array()[25].wrapping_sub(rhs.as_array()[25]),
    self.as_array()[26].wrapping_sub(rhs.as_array()[26]),
    self.as_array()[27].wrapping_sub(rhs.as_array()[27]),
    self.as_array()[28].wrapping_sub(rhs.as_array()[28]),
    self.as_array()[29].wrapping_sub(rhs.as_array()[29]),
    self.as_array()[30].wrapping_sub(rhs.as_array()[30]),
    self.as_array()[31].wrapping_sub(rhs.as_array()[31]),
])
§AVX2 Intrinsics Used
§Neon Intrinsics Used
Source§

type Output = U8x32

The resulting type after applying the - operator.
Source§

impl SubAssign for U8x32

Source§

fn sub_assign(&mut self, other: U8x32)

Performs the -= operation. Read more
Source§

impl Zeroable for U8x32

§

fn zeroed() -> Self

Source§

impl Copy for U8x32

Source§

impl Eq for U8x32

Source§

impl Pod for U8x32

Auto Trait Implementations§

§

impl Freeze for U8x32

§

impl RefUnwindSafe for U8x32

§

impl Send for U8x32

§

impl Sync for U8x32

§

impl Unpin for U8x32

§

impl UnwindSafe for U8x32

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
§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
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> Same for T

Source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> NoUninit for T
where T: Pod,