avoid fallback logic (and we do not need the flag value currently anyway)

This commit is contained in:
Ralf Jung 2020-11-19 09:36:06 +01:00
parent cdb7adb4b3
commit 517728bf97

View File

@ -208,11 +208,9 @@ fn getrandom<'tcx>(
// The only supported flags are GRND_RANDOM and GRND_NONBLOCK,
// neither of which have any effect on our current PRNG.
let flags = this.read_scalar(flags)?;
// Either `i32` or `isize` is fine.
if flags.to_machine_isize(this).is_err() {
flags.to_i32()?;
}
let _flags = this.read_scalar(flags)?;
// FIXME: Check that this is an integer type of the right size.
// Currently, some callers pass i32 and some usize, is that even allowed?
this.gen_random(ptr, len)?;
this.write_scalar(Scalar::from_machine_usize(len, this), dest)?;