From bf6e06060bd9777facea738c84ddf9d9d2f93664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Damien?= Date: Mon, 2 Oct 2023 17:20:58 +0200 Subject: [PATCH] stm32: avoid useless endian conversion in rng --- embassy-stm32/src/rng.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embassy-stm32/src/rng.rs b/embassy-stm32/src/rng.rs index 0979dce8..5080cf03 100644 --- a/embassy-stm32/src/rng.rs +++ b/embassy-stm32/src/rng.rs @@ -164,7 +164,7 @@ impl<'d, T: Instance> Rng<'d, T> { return Err(Error::SeedError); } // write bytes to chunk - for (dest, src) in chunk.iter_mut().zip(random_word.to_be_bytes().iter()) { + for (dest, src) in chunk.iter_mut().zip(random_word.to_ne_bytes().iter()) { *dest = *src } } @@ -195,7 +195,7 @@ impl<'d, T: Instance> RngCore for Rng<'d, T> { fn fill_bytes(&mut self, dest: &mut [u8]) { for chunk in dest.chunks_mut(4) { let rand = self.next_u32(); - for (slot, num) in chunk.iter_mut().zip(rand.to_be_bytes().iter()) { + for (slot, num) in chunk.iter_mut().zip(rand.to_ne_bytes().iter()) { *slot = *num } }