6 /// A type representing a vector lane count.
7 pub struct LaneCount<const LANES: usize>;
9 impl<const LANES: usize> LaneCount<LANES> {
10 /// The number of bytes in a bitmask with this many lanes.
11 pub const BITMASK_LEN: usize = (LANES + 7) / 8;
14 /// Helper trait for vector lane counts.
15 pub trait SupportedLaneCount: Sealed {
17 type BitMask: Copy + Default + AsRef<[u8]> + AsMut<[u8]>;
20 impl<const LANES: usize> Sealed for LaneCount<LANES> {}
22 impl SupportedLaneCount for LaneCount<1> {
23 type BitMask = [u8; 1];
25 impl SupportedLaneCount for LaneCount<2> {
26 type BitMask = [u8; 1];
28 impl SupportedLaneCount for LaneCount<4> {
29 type BitMask = [u8; 1];
31 impl SupportedLaneCount for LaneCount<8> {
32 type BitMask = [u8; 1];
34 impl SupportedLaneCount for LaneCount<16> {
35 type BitMask = [u8; 2];
37 impl SupportedLaneCount for LaneCount<32> {
38 type BitMask = [u8; 4];
40 impl SupportedLaneCount for LaneCount<64> {
41 type BitMask = [u8; 8];