diff options
Diffstat (limited to 'src/librustc_data_structures/bitvec.rs')
| -rw-r--r-- | src/librustc_data_structures/bitvec.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs index 94edaa746f9..80cdb0e4417 100644 --- a/src/librustc_data_structures/bitvec.rs +++ b/src/librustc_data_structures/bitvec.rs @@ -51,6 +51,17 @@ impl BitVector { new_value != value } + /// Returns true if the bit has changed. + #[inline] + pub fn remove(&mut self, bit: usize) -> bool { + let (word, mask) = word_mask(bit); + let data = &mut self.data[word]; + let value = *data; + let new_value = value & !mask; + *data = new_value; + new_value != value + } + #[inline] pub fn insert_all(&mut self, all: &BitVector) -> bool { assert!(self.data.len() == all.data.len()); |
