Skip to content

Commit 71af2e0

Browse files
committed
micro optimisation for clearing least significant bit
1 parent ad47fc4 commit 71af2e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

compiler/rustc_index/src/bit_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ impl<'a, T: Idx> Iterator for BitIter<'a, T> {
913913
// Get the position of the next set bit in the current word,
914914
// then clear the bit.
915915
let bit_pos = self.word.trailing_zeros() as usize;
916-
self.word ^= 1 << bit_pos;
916+
self.word &= self.word - 1;
917917
return Some(T::new(bit_pos + self.offset));
918918
}
919919

0 commit comments

Comments
 (0)