Use pre-defined u32 layout

Also fix typo and remove newline
This commit is contained in:
Samrat Man Singh 2020-04-14 09:40:40 +05:30
parent 5f6d250b30
commit f6bb8111f2
2 changed files with 4 additions and 4 deletions

View file

@ -169,13 +169,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
let info = this.deref_operand(info_op)?;
// Since we return nanoseceonds instead of ticks from
// Since we return nanoseconds instead of ticks from
// `mach_absolute_time`, we don't need to scale the absolute
// time.
let (numer, denom) = (1,1);
let uint32_layout = this.layout_of(this.tcx.types.u32)?;
let imms = [
immty_from_int_checked(numer, this.libc_ty_layout("uint32_t")?)?,
immty_from_int_checked(denom, this.libc_ty_layout("uint32_t")?)?
immty_from_int_checked(numer, uint32_layout)?,
immty_from_int_checked(denom, uint32_layout)?
];
this.write_packed_immediates(info, &imms)?;

View file

@ -24,7 +24,6 @@ fn main() {
for _ in 0..10 { drop(vec![42]); }
let now2 = Instant::now();
assert!(now2 > now1);
let diff = now2.duration_since(now1);
assert_eq!(now1 + diff, now2);
assert_eq!(now2 - diff, now1);