Bucket refresher. Broken

This commit is contained in:
Igor Katson 2023-11-30 11:38:15 +00:00
parent 658bbdb652
commit c8967f2469
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 125 additions and 48 deletions

View file

@ -102,6 +102,12 @@ impl Id20 {
}
Id20(xor)
}
pub fn get_bit(&self, bit: u8) -> bool {
let n = self.0[(bit / 8) as usize];
let mask = !(1 << (7 - bit % 8));
n & mask > 0
}
pub fn set_bit(&mut self, bit: u8, value: bool) {
let n = &mut self.0[(bit / 8) as usize];
if value {