Trait SimdUint
pub trait SimdUint: Copy
Operations on SIMD vectors of unsigned integers.
Associated Types
type Scalar;Scalar type contained by this SIMD vector type.
type Cast<T: SimdElement>;A SIMD vector with a different element type.
Required Methods
fn cast<T: SimdCast>(self) -> Self::Cast<T>Performs elementwise conversion of this vector's elements to another SIMD-valid type.
This follows the semantics of Rust's
asconversion for casting integers (wrapping to other integer types, and saturating to float types).fn wrapping_neg(self) -> SelfWrapping negation.
Like
u32::wrapping_neg, all applications of this function will wrap, with the exception of-0.fn saturating_add(self, second: Self) -> SelfLanewise saturating add.
Examples
# # use simd; # use simd; # use *; use MAX; let x = from_array; let max = splat; let unsat = x + max; let sat = x.saturating_add; assert_eq!; assert_eq!;fn saturating_sub(self, second: Self) -> SelfLanewise saturating subtract.
Examples
# # use simd; # use simd; # use *; use MAX; let x = from_array; let max = splat; let unsat = x - max; let sat = x.saturating_sub; assert_eq!; assert_eq!;fn abs_diff(self, second: Self) -> SelfLanewise absolute difference. Every element becomes the absolute difference of
selfandsecond.Examples
# # use simd; # use simd; # use *; use MAX; let a = from_array; let b = from_array; assert_eq!;fn reduce_sum(self) -> Self::ScalarReturns the sum of the elements of the vector, with wrapping addition.
fn reduce_product(self) -> Self::ScalarReturns the product of the elements of the vector, with wrapping multiplication.
fn reduce_max(self) -> Self::ScalarReturns the maximum element in the vector.
fn reduce_min(self) -> Self::ScalarReturns the minimum element in the vector.
fn reduce_and(self) -> Self::ScalarReturns the cumulative bitwise "and" across the elements of the vector.
fn reduce_or(self) -> Self::ScalarReturns the cumulative bitwise "or" across the elements of the vector.
fn reduce_xor(self) -> Self::ScalarReturns the cumulative bitwise "xor" across the elements of the vector.
fn swap_bytes(self) -> SelfReverses the byte order of each element.
fn reverse_bits(self) -> SelfReverses the order of bits in each elemnent. The least significant bit becomes the most significant bit, second least-significant bit becomes second most-significant bit, etc.
fn count_ones(self) -> SelfReturns the number of ones in the binary representation of each element.
fn count_zeros(self) -> SelfReturns the number of zeros in the binary representation of each element.
fn leading_zeros(self) -> SelfReturns the number of leading zeros in the binary representation of each element.
fn trailing_zeros(self) -> SelfReturns the number of trailing zeros in the binary representation of each element.
fn leading_ones(self) -> SelfReturns the number of leading ones in the binary representation of each element.
fn trailing_ones(self) -> SelfReturns the number of trailing ones in the binary representation of each element.