Skip to content

Commit 3439347

Browse files
Merge pull request #468 from hkBst/div-ceil
clippy fix: use div_ceil
2 parents 704a1a9 + b47a091 commit 3439347

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/core_simd/src/lane_count.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct LaneCount<const N: usize>;
88

99
impl<const N: usize> LaneCount<N> {
1010
/// 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);
1212
}
1313

1414
/// Statically guarantees that a lane count is marked as supported.
@@ -31,13 +31,12 @@ macro_rules! supported_lane_count {
3131
($($lanes:literal),+) => {
3232
$(
3333
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];
3636
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];
3938
if $lanes % 8 > 0 {
40-
array[LEN - 1] = (!0) >> (8 - $lanes % 8);
39+
array[Self::BITMASK_LEN - 1] = (!0) >> (8 - $lanes % 8);
4140
}
4241
array
4342
};

0 commit comments

Comments
 (0)