pub trait SimdInt: Copy + Sealed {
    type Mask;
    type Scalar;
Show 15 methods
    // Required methods
    fn saturating_add(self, second: Self) -> Self;
    fn saturating_sub(self, second: Self) -> Self;
    fn abs(self) -> Self;
    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;
}🔬This is a nightly-only experimental API. (
portable_simd #86656)Expand description
对有符号整数的 SIMD vectors 的操作。
Required Associated Types§
Required Methods§
sourcefn saturating_add(self, second: Self) -> Self
 
fn saturating_add(self, second: Self) -> Self
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn saturating_sub(self, second: Self) -> Self
 
fn saturating_sub(self, second: Self) -> Self
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn saturating_abs(self) -> Self
 
fn saturating_abs(self) -> Self
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn saturating_neg(self) -> Self
 
fn saturating_neg(self) -> Self
🔬This is a nightly-only experimental API. (
portable_simd #86656)Lanewise 饱和否定,在 Rust 中实现。 作为 neg(),除了 MIN 值变为 MAX 而不是它本身。
Examples
use core::i32::{MIN, MAX};
let x = Simd::from_array([MIN, -2, 3, MAX]);
let unsat = -x;
let sat = x.saturating_neg();
assert_eq!(unsat, Simd::from_array([MIN, 2, -3, MIN + 1]));
assert_eq!(sat, Simd::from_array([MAX, 2, -3, MIN + 1]));sourcefn is_positive(self) -> Self::Mask
 
fn is_positive(self) -> Self::Mask
🔬This is a nightly-only experimental API. (
portable_simd #86656)对于每个正 lane 返回真,如果为零或负则返回假。
sourcefn is_negative(self) -> Self::Mask
 
fn is_negative(self) -> Self::Mask
🔬This is a nightly-only experimental API. (
portable_simd #86656)对于每个负 lane 返回 true,如果为零或正则返回 false。
sourcefn signum(self) -> Self
 
fn signum(self) -> Self
🔬This is a nightly-only experimental API. (
portable_simd #86656)返回代表每个 lane 符号的数字。
- 0如果数字为零
- 1如果数字是正数
- -1如果数字是负数
sourcefn reduce_sum(self) -> Self::Scalar
 
fn reduce_sum(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn reduce_product(self) -> Self::Scalar
 
fn reduce_product(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn reduce_max(self) -> Self::Scalar
 
fn reduce_max(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn reduce_min(self) -> Self::Scalar
 
fn reduce_min(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)sourcefn reduce_and(self) -> Self::Scalar
 
fn reduce_and(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)返回跨 vector lane 的累积按位与。
sourcefn reduce_or(self) -> Self::Scalar
 
fn reduce_or(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)返回跨 vector lane 的累积按位或。
sourcefn reduce_xor(self) -> Self::Scalar
 
fn reduce_xor(self) -> Self::Scalar
🔬This is a nightly-only experimental API. (
portable_simd #86656)返回跨 vector lane 的累积按位异或。