pub trait SimdUint: Copy + Sealed {
    type Scalar;

    // Required methods
    fn saturating_add(self, second: Self) -> Self;
    fn saturating_sub(self, second: Self) -> Self;
    fn reduce_sum(self) -> Self::Scalar;
    fn reduce_product(self) -> Self::Scalar;
    fn reduce_max(self) -> Self::Scalar;
    fn reduce_min(self) -> Self::Scalar;
    fn reduce_and(self) -> Self::Scalar;
    fn reduce_or(self) -> Self::Scalar;
    fn reduce_xor(self) -> Self::Scalar;
}
🔬This is a nightly-only experimental API. (portable_simd)
Available on non-crate feature miri-test-libstd only.
Expand description

Operations on SIMD vectors of unsigned integers.

Required Associated Types§

source

type Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Scalar type contained by this SIMD vector type.

Required Methods§

source

fn saturating_add(self, second: Self) -> Self

🔬This is a nightly-only experimental API. (portable_simd)

Lanewise saturating add.

Examples
use core::u32::MAX;
let x = Simd::from_array([2, 1, 0, MAX]);
let max = Simd::splat(MAX);
let unsat = x + max;
let sat = x.saturating_add(max);
assert_eq!(unsat, Simd::from_array([1, 0, MAX, MAX - 1]));
assert_eq!(sat, max);
source

fn saturating_sub(self, second: Self) -> Self

🔬This is a nightly-only experimental API. (portable_simd)

Lanewise saturating subtract.

Examples
use core::u32::MAX;
let x = Simd::from_array([2, 1, 0, MAX]);
let max = Simd::splat(MAX);
let unsat = x - max;
let sat = x.saturating_sub(max);
assert_eq!(unsat, Simd::from_array([3, 2, 1, 0]));
assert_eq!(sat, Simd::splat(0));
source

fn reduce_sum(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the sum of the lanes of the vector, with wrapping addition.

source

fn reduce_product(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the product of the lanes of the vector, with wrapping multiplication.

source

fn reduce_max(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the maximum lane in the vector.

source

fn reduce_min(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the minimum lane in the vector.

source

fn reduce_and(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the cumulative bitwise “and” across the lanes of the vector.

source

fn reduce_or(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the cumulative bitwise “or” across the lanes of the vector.

source

fn reduce_xor(self) -> Self::Scalar

🔬This is a nightly-only experimental API. (portable_simd)

Returns the cumulative bitwise “xor” across the lanes of the vector.

Implementors§

source§

impl<const LANES: usize> SimdUint for Simd<u8, LANES>where LaneCount<LANES>: SupportedLaneCount,

§

type Scalar = u8

source§

impl<const LANES: usize> SimdUint for Simd<u16, LANES>where LaneCount<LANES>: SupportedLaneCount,

§

type Scalar = u16

source§

impl<const LANES: usize> SimdUint for Simd<u32, LANES>where LaneCount<LANES>: SupportedLaneCount,

§

type Scalar = u32

source§

impl<const LANES: usize> SimdUint for Simd<u64, LANES>where LaneCount<LANES>: SupportedLaneCount,

§

type Scalar = u64

source§

impl<const LANES: usize> SimdUint for Simd<usize, LANES>where LaneCount<LANES>: SupportedLaneCount,