mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
less panicy read_bool
This commit is contained in:
parent
34411a7c80
commit
5b89a5940d
2 changed files with 3 additions and 3 deletions
|
|
@ -8,5 +8,5 @@ matrix:
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
script:
|
script:
|
||||||
- cargo build --verbose --all
|
- cargo test --all
|
||||||
- cargo test --verbose --all
|
- cargo test --all --all-features
|
||||||
|
|
@ -174,7 +174,7 @@ where
|
||||||
.get(byte_index)
|
.get(byte_index)
|
||||||
.ok_or_else(|| ReadError::NotEnoughData {
|
.ok_or_else(|| ReadError::NotEnoughData {
|
||||||
requested: 1,
|
requested: 1,
|
||||||
bits_left: self.bit_len() - position,
|
bits_left: self.bit_len().saturating_sub(position),
|
||||||
})
|
})
|
||||||
.map(|byte| {
|
.map(|byte| {
|
||||||
let shifted = byte >> bit_offset;
|
let shifted = byte >> bit_offset;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue