From 04892d915512abe85d7a663b68dc62ef802eef30 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 10 Aug 2019 11:33:33 +0200 Subject: [PATCH] typo --- src/shims/foreign_items.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 4cca6b9efdd..0288773044a 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -597,8 +597,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx "_ldexp" | "ldexp" | "scalbn" => { let x = this.read_scalar(args[0])?.to_f64()?; let exp = this.read_scalar(args[1])?.to_i32()?; + // Saturating cast to i16. Even those are outside the valid exponent range to - // `scalbn` below will to its over/underflow handling. + // `scalbn` below will do its over/underflow handling. let exp = if exp > i16::max_value() as i32 { i16::max_value() } else if exp < i16::min_value() as i32 { @@ -606,6 +607,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx } else { exp.try_into().unwrap() }; + let res = x.scalbn(exp); this.write_scalar(Scalar::from_f64(res), dest)?; }