Skip to content

Commit 3ae01a6

Browse files
committed
also support scalbn itself
1 parent 5e3035b commit 3ae01a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/shims/foreign_items.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
580580
};
581581
this.write_scalar(Scalar::from_u64(f.to_bits()), dest)?;
582582
}
583-
// underscore case for windows
583+
// underscore case for windows, here and below
584+
// (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019)
584585
"_hypot" | "hypot" | "atan2" => {
585586
// FIXME: Using host floats.
586587
let f1 = f64::from_bits(this.read_scalar(args[0])?.to_u64()?);
@@ -592,11 +593,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
592593
};
593594
this.write_scalar(Scalar::from_u64(n.to_bits()), dest)?;
594595
}
595-
// underscore case for windows
596-
"_ldexp" | "ldexp" => {
596+
// For radix-2 (binary) systems, `ldexp` and `scalbn` are the same.
597+
"_ldexp" | "ldexp" | "scalbn" => {
597598
let x = this.read_scalar(args[0])?.to_f64()?;
598599
let exp = this.read_scalar(args[1])?.to_i32()?;
599-
// For radix-2 (binary) systems, `ldexp` and `scalbn` are the same.
600600
let res = x.scalbn(exp.try_into().unwrap());
601601
this.write_scalar(Scalar::from_f64(res), dest)?;
602602
}

0 commit comments

Comments
 (0)