File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ pub struct LaneCount<const N: usize>;
8
8
9
9
impl < const N : usize > LaneCount < N > {
10
10
/// The number of bytes in a bitmask with this many lanes.
11
- pub const BITMASK_LEN : usize = ( N + 7 ) / 8 ;
11
+ pub const BITMASK_LEN : usize = N . div_ceil ( 8 ) ;
12
12
}
13
13
14
14
/// Statically guarantees that a lane count is marked as supported.
@@ -31,13 +31,12 @@ macro_rules! supported_lane_count {
31
31
( $( $lanes: literal) ,+) => {
32
32
$(
33
33
impl SupportedLaneCount for LaneCount <$lanes> {
34
- type BitMask = [ u8 ; ( $lanes + 7 ) / 8 ] ;
35
- const EMPTY_BIT_MASK : Self :: BitMask = [ 0 ; ( $lanes + 7 ) / 8 ] ;
34
+ type BitMask = [ u8 ; Self :: BITMASK_LEN ] ;
35
+ const EMPTY_BIT_MASK : Self :: BitMask = [ 0 ; Self :: BITMASK_LEN ] ;
36
36
const FULL_BIT_MASK : Self :: BitMask = {
37
- const LEN : usize = ( $lanes + 7 ) / 8 ;
38
- let mut array = [ !0u8 ; LEN ] ;
37
+ let mut array = [ !0u8 ; Self :: BITMASK_LEN ] ;
39
38
if $lanes % 8 > 0 {
40
- array[ LEN - 1 ] = ( !0 ) >> ( 8 - $lanes % 8 ) ;
39
+ array[ Self :: BITMASK_LEN - 1 ] = ( !0 ) >> ( 8 - $lanes % 8 ) ;
41
40
}
42
41
array
43
42
} ;
You can’t perform that action at this time.
0 commit comments