Merge pull request #1997 from dzamlo/main
stm32: avoid useless endian conversion in rng
This commit is contained in:
commit
ce0add61f8
@ -164,7 +164,7 @@ impl<'d, T: Instance> Rng<'d, T> {
|
|||||||
return Err(Error::SeedError);
|
return Err(Error::SeedError);
|
||||||
}
|
}
|
||||||
// write bytes to chunk
|
// 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
|
*dest = *src
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ impl<'d, T: Instance> RngCore for Rng<'d, T> {
|
|||||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||||
for chunk in dest.chunks_mut(4) {
|
for chunk in dest.chunks_mut(4) {
|
||||||
let rand = self.next_u32();
|
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
|
*slot = *num
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user