mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
remove unneeded extra bounds check when reading boolean
This commit is contained in:
parent
bb54b1c917
commit
18cd799a9b
1 changed files with 3 additions and 1 deletions
|
|
@ -145,7 +145,9 @@ impl<E> BitBuffer<E>
|
|||
});
|
||||
}
|
||||
|
||||
let byte = self.bytes[byte_index];
|
||||
let byte = unsafe {
|
||||
self.bytes.get_unchecked(byte_index)
|
||||
};
|
||||
let shifted = byte >> bit_offset;
|
||||
Ok(shifted & 1u8 == 1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue