diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs index f564f46dd2b..245f5d61099 100644 --- a/src/librustc_data_structures/bitvec.rs +++ b/src/librustc_data_structures/bitvec.rs @@ -75,6 +75,13 @@ impl BitVector { new_value != value } + /// Sets all bits to true. + pub fn insert_all(&mut self) { + for data in &mut self.data { + *data = u128::max_value(); + } + } + /// Returns true if the bit has changed. #[inline] pub fn remove(&mut self, bit: C) -> bool { @@ -359,6 +366,12 @@ impl SparseBitMatrix { self.vector[into].merge(from) } + /// Add all bits to the given row. + pub fn add_all(&mut self, row: R) { + self.ensure_row(row); + self.vector[row].insert_all(); + } + /// Number of elements in the matrix. pub fn len(&self) -> usize { self.vector.len()