mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 12:58:31 +00:00
another loop fixed
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#![cfg_attr(not(feature = "clippy"), allow(needless_range_loop))]
|
||||
|
||||
use super::{
|
||||
LENGTH_BYTES,
|
||||
};
|
||||
@@ -79,10 +77,10 @@ pub fn decode_length(bytes: &[u8], index: usize, length_bytes: usize)
|
||||
return Err(DecodeError::TooShort);
|
||||
};
|
||||
let mut len: usize = 0;
|
||||
for i in index..index+length_bytes {
|
||||
for (i, byte) in bytes.iter().enumerate().take(index+length_bytes).skip(index) {
|
||||
let offset = (index+length_bytes - i - 1) * 8;
|
||||
len |= (bytes[i] as usize) << offset;
|
||||
};
|
||||
len |= (*byte as usize) << offset;
|
||||
}
|
||||
Ok(len)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user