diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /vendor/packed_simd_2/src/sealed.rs | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/packed_simd_2/src/sealed.rs')
-rw-r--r-- | vendor/packed_simd_2/src/sealed.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/packed_simd_2/src/sealed.rs b/vendor/packed_simd_2/src/sealed.rs new file mode 100644 index 000000000..0ec20300f --- /dev/null +++ b/vendor/packed_simd_2/src/sealed.rs @@ -0,0 +1,42 @@ +//! Sealed traits + +/// A sealed trait, this is logically private to the crate +/// and will prevent implementations from outside the crate +pub trait Seal<T = ()> {} + +/// Trait implemented by arrays that can be SIMD types. +pub trait SimdArray: Seal { + /// The type of the #[repr(simd)] type. + type Tuple: Copy + Clone; + /// The element type of the vector. + type T; + /// The number of elements in the array. + const N: usize; + /// The type: `[u32; Self::N]`. + type NT; +} + +/// This traits is used to constraint the arguments +/// and result type of the portable shuffles. +#[doc(hidden)] +pub trait Shuffle<Lanes>: Seal<Lanes> { + // Lanes is a `[u32; N]` where `N` is the number of vector lanes + + /// The result type of the shuffle. + type Output; +} + +/// This trait is implemented by all SIMD vector types. +pub trait Simd: Seal { + /// Element type of the SIMD vector + type Element; + /// The number of elements in the SIMD vector. + const LANES: usize; + /// The type: `[u32; Self::N]`. + type LanesType; +} + +/// This trait is implemented by all mask types +pub trait Mask: Seal { + fn test(&self) -> bool; +} |