File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change 4141
4242use core:: convert:: AsMut ;
4343use core:: default:: Default ;
44- use core:: ptr:: copy_nonoverlapping;
4544
4645#[ cfg( all( feature = "alloc" , not( feature = "std" ) ) ) ] extern crate alloc;
4746#[ cfg( all( feature = "alloc" , not( feature = "std" ) ) ) ] use alloc:: boxed:: Box ;
@@ -313,12 +312,8 @@ pub trait SeedableRng: Sized {
313312 // Use PCG output function with to_le to generate x:
314313 let xorshifted = ( ( ( state >> 18 ) ^ state) >> 27 ) as u32 ;
315314 let rot = ( state >> 59 ) as u32 ;
316- let x = xorshifted. rotate_right ( rot) . to_le ( ) ;
317-
318- unsafe {
319- let p = & x as * const u32 as * const u8 ;
320- copy_nonoverlapping ( p, chunk. as_mut_ptr ( ) , chunk. len ( ) ) ;
321- }
315+ let x = xorshifted. rotate_right ( rot) ;
316+ chunk. copy_from_slice ( & x. to_le_bytes ( ) ) ;
322317 }
323318
324319 Self :: from_seed ( seed)
You can’t perform that action at this time.
0 commit comments