Skip to content

Commit c3f7d46

Browse files
committed
Make BitMask::flip also work w/o SSE2
Thanks miri!
1 parent 7711768 commit c3f7d46

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/raw/bitmask.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ impl BitMask {
3232
#[allow(clippy::cast_ptr_alignment)]
3333
#[cfg(feature = "raw")]
3434
pub unsafe fn flip(&mut self, index: usize) -> bool {
35-
let mask = 1 << (index * BITMASK_STRIDE);
35+
// NOTE: The + BITMASK_STRIDE - 1 is to set the high bit.
36+
let mask = 1 << (index * BITMASK_STRIDE + BITMASK_STRIDE - 1);
3637
self.0 ^= mask;
3738
// The bit was set if the bit is now 0.
3839
self.0 & mask == 0

0 commit comments

Comments
 (0)