1
0
Fork 0
mirror of https://codeberg.org/icewind/bitbuffer.git synced 2026-06-03 16:44:06 +02:00
This commit is contained in:
Robin Appelman 2022-04-09 18:35:35 +02:00
commit bc5d74038e
2 changed files with 8 additions and 5 deletions

View file

@ -2,7 +2,7 @@
name = "bitbuffer"
version = "0.10.3"
authors = ["Robin Appelman <robin@icewind.nl>"]
edition = "2018"
edition = "2021"
description = "Reading bit sequences from a byte slice"
license = "MIT OR Apache-2.0"
repository = "https://github.com/icewind1991/bitbuffer"

View file

@ -290,7 +290,7 @@ macro_rules! impl_split_fit {
fn split_fit_usize<E: Endianness>(self) -> Self::Iter {
assert!(size_of::<Self>() < size_of::<usize>());
Self::Iter::new([(self as usize, size_of::<Self>() as u8 * 8)])
[(self as usize, size_of::<Self>() as u8 * 8)].into_iter()
}
}
};
@ -341,7 +341,7 @@ impl SplitFitUsize for u64 {
type Iter = array::IntoIter<(usize, u8), 3>;
fn split_fit_usize<E: Endianness>(self) -> Self::Iter {
Self::Iter::new(if E::is_le() {
(if E::is_le() {
[
((self & (Self::MAX >> 40)) as usize, 24),
((self >> 24 & (Self::MAX >> 16)) as usize, 24),
@ -354,6 +354,7 @@ impl SplitFitUsize for u64 {
((self & (Self::MAX >> 40)) as usize, 24),
]
})
.into_iter()
}
}
@ -363,7 +364,7 @@ impl SplitFitUsize for u128 {
type Iter = array::IntoIter<(usize, u8), 6>;
fn split_fit_usize<E: Endianness>(self) -> Self::Iter {
Self::Iter::new(if E::is_le() {
(if E::is_le() {
[
((self & (Self::MAX >> 104)) as usize, 24),
((self >> 24 & (Self::MAX >> 80)) as usize, 24),
@ -382,6 +383,7 @@ impl SplitFitUsize for u128 {
((self & (Self::MAX >> 104)) as usize, 24),
]
})
.into_iter()
}
}
@ -392,7 +394,7 @@ impl SplitFitUsize for usize {
fn split_fit_usize<E: Endianness>(self) -> Self::Iter {
const USIZE_BITS: usize = size_of::<usize>() * 8;
Self::Iter::new(if E::is_le() {
(if E::is_le() {
[
(
(self & (Self::MAX >> (USIZE_BITS - 8))) as usize,
@ -409,6 +411,7 @@ impl SplitFitUsize for usize {
),
]
})
.into_iter()
}
}