File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ pub trait Mask: Sized + BitOr<Self> + BitOrAssign + BitAnd<Self> {
3232/// Trait for the bitmask of a vector Mask.
3333pub 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}
Original file line number Diff line number Diff 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 ( )
You can’t perform that action at this time.
0 commit comments