1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 16:44:06 +02:00

unbreak int and float

This commit is contained in:
Robin Appelman 2021-07-19 15:20:23 +02:00
commit 60563afc7a

View file

@ -361,7 +361,7 @@ where
}); });
} }
if position + USIZE_BIT_SIZE > self.bit_len() { if position + count + USIZE_BIT_SIZE > self.bit_len() {
if position + count > self.bit_len() { if position + count > self.bit_len() {
return if position > self.bit_len() { return if position > self.bit_len() {
Err(BitError::IndexOutOfBounds { Err(BitError::IndexOutOfBounds {
@ -711,7 +711,7 @@ where
T: Float + UncheckedPrimitiveFloat, T: Float + UncheckedPrimitiveFloat,
{ {
let type_bit_size = size_of::<T>() * 8; let type_bit_size = size_of::<T>() * 8;
if position + USIZE_BIT_SIZE > self.bit_len() { if position + type_bit_size + USIZE_BIT_SIZE > self.bit_len() {
if position + type_bit_size > self.bit_len() { if position + type_bit_size > self.bit_len() {
if position > self.bit_len() { if position > self.bit_len() {
return Err(BitError::IndexOutOfBounds { return Err(BitError::IndexOutOfBounds {