Skip to content

Commit fc7a021

Browse files
committed
Fix loop in read_bytes
1 parent bd9e3c2 commit fc7a021

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ pub fn fill_bytes_via_gen_block<W: Word, const N: usize>(
395395
///
396396
/// This function is written in a way which helps the compiler to compile it down
397397
/// to one `memcpy`. The temporary buffer gets eliminated by the compiler, see:
398-
/// https://rust.godbolt.org/z/xbo88cbsn
398+
/// https://rust.godbolt.org/z/T8f77KjGc
399399
#[inline]
400400
fn read_bytes<W: Word, const N: usize>(block: &[W; N], dst: &mut [u8], pos: W) -> W {
401401
let word_size = size_of::<W>();
@@ -413,7 +413,7 @@ fn read_bytes<W: Word, const N: usize>(block: &[W; N], dst: &mut [u8], pos: W) -
413413
core::slice::from_raw_parts_mut(p, len)
414414
};
415415

416-
for (src, dst) in block.iter().zip(buf.chunks_exact_mut(4)) {
416+
for (src, dst) in block.iter().zip(buf.chunks_exact_mut(word_size)) {
417417
let val = src.to_le_bytes();
418418
dst.copy_from_slice(val.as_ref())
419419
}

0 commit comments

Comments
 (0)