mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
minor cleanup
This commit is contained in:
parent
6c094d78a8
commit
e1079a412b
1 changed files with 2 additions and 4 deletions
|
|
@ -115,7 +115,7 @@ where
|
||||||
} else {
|
} else {
|
||||||
container >> (usize_bit_size - bit_offset - count)
|
container >> (usize_bit_size - bit_offset - count)
|
||||||
};
|
};
|
||||||
let mask = !(usize::max_value() << count);
|
let mask = !(std::usize::MAX << count);
|
||||||
shifted & mask
|
shifted & mask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,6 +193,7 @@ where
|
||||||
T: PrimInt + BitOrAssign + IsSigned + UncheckedPrimitiveInt + BitXor,
|
T: PrimInt + BitOrAssign + IsSigned + UncheckedPrimitiveInt + BitXor,
|
||||||
{
|
{
|
||||||
let type_bit_size = size_of::<T>() * 8;
|
let type_bit_size = size_of::<T>() * 8;
|
||||||
|
let usize_bit_size = size_of::<usize>() * 8;
|
||||||
|
|
||||||
if type_bit_size < count {
|
if type_bit_size < count {
|
||||||
return Err(ReadError::TooManyBits {
|
return Err(ReadError::TooManyBits {
|
||||||
|
|
@ -215,9 +216,6 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let type_bit_size = size_of::<T>() * 8;
|
|
||||||
let usize_bit_size = size_of::<usize>() * 8;
|
|
||||||
|
|
||||||
let bit_offset = position & 7;
|
let bit_offset = position & 7;
|
||||||
|
|
||||||
let fit_usize = count + bit_offset < usize_bit_size;
|
let fit_usize = count + bit_offset < usize_bit_size;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue