Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unsafe code from SeedableRng::seed_from_u64 #962

Merged
merged 2 commits into from Apr 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions rand_core/src/lib.rs
Expand Up @@ -314,11 +314,7 @@ pub trait SeedableRng: Sized {
let xorshifted = (((state >> 18) ^ state) >> 27) as u32;
let rot = (state >> 59) as u32;
let x = xorshifted.rotate_right(rot).to_le();
Shnatsel marked this conversation as resolved.
Show resolved Hide resolved

unsafe {
let p = &x as *const u32 as *const u8;
copy_nonoverlapping(p, chunk.as_mut_ptr(), chunk.len());
}
chunk.copy_from_slice(&x.to_ne_bytes());
}

Self::from_seed(seed)
Expand Down