Use a bitset instead of a hash map in HIR ID validator

This commit is contained in:
Jakub Beránek 2022-07-03 13:35:48 +02:00
parent 8c52a83c45
commit 2a57e5efed
No known key found for this signature in database
GPG key ID: 909CD0D26483516B
2 changed files with 14 additions and 4 deletions

View file

@ -1546,6 +1546,16 @@ impl<T: Idx> GrowableBitSet<T> {
let (word_index, mask) = word_index_and_mask(elem);
self.bit_set.words.get(word_index).map_or(false, |word| (word & mask) != 0)
}
#[inline]
pub fn iter(&self) -> BitIter<'_, T> {
self.bit_set.iter()
}
#[inline]
pub fn len(&self) -> usize {
self.bit_set.count()
}
}
impl<T: Idx> From<BitSet<T>> for GrowableBitSet<T> {