Skip to content

Commit 94af0f5

Browse files
committed
fix allow dead_code for scalar-only targets
Signed-off-by: satyamg1620 <Satyam.Gupta.3@ibm.com>
1 parent f69338c commit 94af0f5

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/simd/bits.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ macro_rules! impl_bits {
1414

1515
#[inline]
1616
fn as_little_endian(&self) -> Self {
17-
// The bitmask this operates on is produced in software with a
18-
// canonical layout (lane `i` -> bit `i`) on every target — see
19-
// `Mask::bitmask` in `v128.rs`. It carries no byte order to
20-
// convert, so this is the identity on both endiannesses.
21-
// `swap_bytes` on big-endian would reorder bytes without
22-
// reversing bit order, landing `first_offset` on the wrong bit.
17+
// The software bitmask already uses a canonical layout
18+
// (lane `i` -> bit `i`), so there is no byte order to swap.
2319
self.clone()
2420
}
2521

src/simd/traits.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ pub trait Mask: Sized + BitOr<Self> + BitOrAssign + BitAnd<Self> {
3232
/// Trait for the bitmask of a vector Mask.
3333
pub trait BitMask {
3434
/// Total bits in the bitmask.
35+
// Used only by the wide-SIMD kernels (sse2/avx2/avx512/neon); dead code on
36+
// scalar-only targets like s390x that compile just `v128`.
37+
#[allow(dead_code)]
3538
const LEN: usize;
3639

3740
/// get the offset of the first `1` bit.
@@ -41,8 +44,10 @@ pub trait BitMask {
4144
fn as_little_endian(&self) -> Self;
4245

4346
/// whether all bits are zero.
47+
#[allow(dead_code)]
4448
fn all_zero(&self) -> bool;
4549

4650
/// clear high n bits.
51+
#[allow(dead_code)]
4752
fn clear_high_bits(&self, n: usize) -> Self;
4853
}

src/simd/v128.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,9 @@ impl Mask for Mask128 {
5858
type Element = u8;
5959

6060
fn bitmask(self) -> Self::BitMask {
61-
// This bitmask is built purely in software from an array, so it has no
62-
// inherent byte order: lane `i` maps to bit `i` on every target. The
63-
// matching `first_offset` (see `bits.rs`) is a plain `trailing_zeros`,
64-
// and the partial-tail clear in `format_string` (`mask & ((1 << nb) -
65-
// 1)`) keeps the low `nb` lanes. Reversing the bit order on big-endian
66-
// here would break both, so keep a single canonical layout.
61+
// Built in software, so the bitmask has no inherent byte order: lane
62+
// `i` maps to bit `i` on every target, matching `first_offset`'s plain
63+
// `trailing_zeros`.
6764
self.0
6865
.iter()
6966
.enumerate()

0 commit comments

Comments
 (0)