Skip to content

Commit

Permalink
Fix call to BitVec::ensure_vec_large_enough and add pub accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed Jun 1, 2021
1 parent 976bea5 commit a4cec0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/syn/bitstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ impl BitVec {
}

pub fn set_bit(&mut self, bit: u64) {
self.ensure_vec_large_enough(bit);
self.ensure_vec_large_enough(bit + 1);
let byte = bit / 8;
let bit = bit % 8;
let mask = 0x80_u8 >> bit;
self.0[byte as usize] |= mask;
}

pub fn reset_bit(&mut self, bit: u64) {
self.ensure_vec_large_enough(bit);
self.ensure_vec_large_enough(bit + 1);
let byte = bit / 8;
let bit = bit % 8;
let mask = 0x80_u8 >> bit;
Expand All @@ -124,6 +124,10 @@ impl BitVec {
}
}

pub fn overall_capacity_at_least(&mut self, bits: u64) {
self.ensure_vec_large_enough(bits);
}

pub fn bit_len(&self) -> u64 {
self.1
}
Expand Down

0 comments on commit a4cec0e

Please sign in to comment.