forked from rust-lang/portable-simd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f93bef3
commit 97c25dd
Showing
21 changed files
with
367 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
mod sealed { | ||
pub trait Sealed {} | ||
} | ||
use sealed::Sealed; | ||
|
||
/// A type representing a vector lane count. | ||
pub struct LaneCount<const LANES: usize>; | ||
|
||
/// Helper trait for vector lane counts. | ||
pub trait SupportedLaneCount: Sealed { | ||
/// The bitmask representation of a mask. | ||
type BitMask: Copy + Default + AsRef<[u8]> + AsMut<[u8]>; | ||
|
||
#[doc(hidden)] | ||
type IntBitMask; | ||
} | ||
|
||
impl<const LANES: usize> Sealed for LaneCount<LANES> {} | ||
|
||
impl SupportedLaneCount for LaneCount<1> { | ||
type BitMask = [u8; 1]; | ||
type IntBitMask = u8; | ||
} | ||
impl SupportedLaneCount for LaneCount<2> { | ||
type BitMask = [u8; 1]; | ||
type IntBitMask = u8; | ||
} | ||
impl SupportedLaneCount for LaneCount<4> { | ||
type BitMask = [u8; 1]; | ||
type IntBitMask = u8; | ||
} | ||
impl SupportedLaneCount for LaneCount<8> { | ||
type BitMask = [u8; 1]; | ||
type IntBitMask = u8; | ||
} | ||
impl SupportedLaneCount for LaneCount<16> { | ||
type BitMask = [u8; 2]; | ||
type IntBitMask = u16; | ||
} | ||
impl SupportedLaneCount for LaneCount<32> { | ||
type BitMask = [u8; 4]; | ||
type IntBitMask = u32; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.