Trait SimdInt
pub trait SimdInt: Copy + Sealed {
type Mask;
type Scalar;
type Unsigned;
type Cast<T: SimdElement>;
Show 25 methods
// Required methods
fn cast<T>(self) -> Self::Cast<T>
where T: SimdCast;
fn saturating_add(self, second: Self) -> Self;
fn saturating_sub(self, second: Self) -> Self;
fn abs(self) -> Self;
fn abs_diff(self, second: Self) -> Self::Unsigned;
fn saturating_abs(self) -> Self;
fn saturating_neg(self) -> Self;
fn is_positive(self) -> Self::Mask;
fn is_negative(self) -> Self::Mask;
fn signum(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;
fn swap_bytes(self) -> Self;
fn reverse_bits(self) -> Self;
fn count_ones(self) -> Self::Unsigned;
fn count_zeros(self) -> Self::Unsigned;
fn leading_zeros(self) -> Self::Unsigned;
fn trailing_zeros(self) -> Self::Unsigned;
fn leading_ones(self) -> Self::Unsigned;
fn trailing_ones(self) -> Self::Unsigned;
}portable_simd #86656)Expand description
Operations on SIMD vectors of signed integers.
Required Associated Types§
type Mask
🔬This is a nightly-only experimental API. (portable_simd #86656)
type Mask
portable_simd #86656)Mask type used for manipulating this SIMD vector type.
type Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
type Scalar
portable_simd #86656)Scalar type contained by this SIMD vector type.
type Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
type Unsigned
portable_simd #86656)A SIMD vector of unsigned integers with the same element size.
type Cast<T: SimdElement>
🔬This is a nightly-only experimental API. (portable_simd #86656)
type Cast<T: SimdElement>
portable_simd #86656)A SIMD vector with a different element type.
Required Methods§
fn cast<T>(self) -> Self::Cast<T>where
T: SimdCast,
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn cast<T>(self) -> Self::Cast<T>where
T: SimdCast,
portable_simd #86656)Performs elementwise conversion of this vector’s elements to another SIMD-valid type.
This follows the semantics of Rust’s as conversion for casting integers (wrapping to
other integer types, and saturating to float types).
fn saturating_add(self, second: Self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn saturating_add(self, second: Self) -> Self
portable_simd #86656)Lanewise saturating add.
§Examples
fn saturating_sub(self, second: Self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn saturating_sub(self, second: Self) -> Self
portable_simd #86656)Lanewise saturating subtract.
§Examples
fn abs(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn abs(self) -> Self
portable_simd #86656)Lanewise absolute value, implemented in Rust. Every element becomes its absolute value.
§Examples
fn abs_diff(self, second: Self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn abs_diff(self, second: Self) -> Self::Unsigned
portable_simd #86656)Lanewise absolute difference.
Every element becomes the absolute difference of self and second.
§Examples
fn saturating_abs(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn saturating_abs(self) -> Self
portable_simd #86656)Lanewise saturating absolute value, implemented in Rust. As abs(), except the MIN value becomes MAX instead of itself.
§Examples
fn saturating_neg(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn saturating_neg(self) -> Self
portable_simd #86656)Lanewise saturating negation, implemented in Rust. As neg(), except the MIN value becomes MAX instead of itself.
§Examples
fn is_positive(self) -> Self::Mask
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn is_positive(self) -> Self::Mask
portable_simd #86656)Returns true for each positive element and false if it is zero or negative.
fn is_negative(self) -> Self::Mask
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn is_negative(self) -> Self::Mask
portable_simd #86656)Returns true for each negative element and false if it is zero or positive.
fn signum(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn signum(self) -> Self
portable_simd #86656)Returns numbers representing the sign of each element.
0if the number is zero1if the number is positive-1if the number is negative
fn reduce_sum(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_sum(self) -> Self::Scalar
portable_simd #86656)Returns the sum of the elements of the vector, with wrapping addition.
§Examples
fn reduce_product(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_product(self) -> Self::Scalar
portable_simd #86656)Returns the product of the elements of the vector, with wrapping multiplication.
§Examples
fn reduce_max(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_max(self) -> Self::Scalar
portable_simd #86656)Returns the maximum element in the vector.
§Examples
fn reduce_min(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_min(self) -> Self::Scalar
portable_simd #86656)Returns the minimum element in the vector.
§Examples
fn reduce_and(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_and(self) -> Self::Scalar
portable_simd #86656)Returns the cumulative bitwise “and” across the elements of the vector.
fn reduce_or(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_or(self) -> Self::Scalar
portable_simd #86656)Returns the cumulative bitwise “or” across the elements of the vector.
fn reduce_xor(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reduce_xor(self) -> Self::Scalar
portable_simd #86656)Returns the cumulative bitwise “xor” across the elements of the vector.
fn swap_bytes(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn swap_bytes(self) -> Self
portable_simd #86656)Reverses the byte order of each element.
fn reverse_bits(self) -> Self
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn reverse_bits(self) -> Self
portable_simd #86656)Reverses 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) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn count_ones(self) -> Self::Unsigned
portable_simd #86656)Returns the number of ones in the binary representation of each element.
fn count_zeros(self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn count_zeros(self) -> Self::Unsigned
portable_simd #86656)Returns the number of zeros in the binary representation of each element.
fn leading_zeros(self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn leading_zeros(self) -> Self::Unsigned
portable_simd #86656)Returns the number of leading zeros in the binary representation of each element.
fn trailing_zeros(self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn trailing_zeros(self) -> Self::Unsigned
portable_simd #86656)Returns the number of trailing zeros in the binary representation of each element.
fn leading_ones(self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn leading_ones(self) -> Self::Unsigned
portable_simd #86656)Returns the number of leading ones in the binary representation of each element.
fn trailing_ones(self) -> Self::Unsigned
🔬This is a nightly-only experimental API. (portable_simd #86656)
fn trailing_ones(self) -> Self::Unsigned
portable_simd #86656)Returns the number of trailing ones in the binary representation of each element.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.