Skip to content

Commit e6a4a1b

Browse files
author
The Miri Conjob Bot
committed
fmt
1 parent bf31cdb commit e6a4a1b

File tree

3 files changed

+15
-25
lines changed

3 files changed

+15
-25
lines changed

src/tools/miri/src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10331033
) {
10341034
// Floating point value is NaN (flagged with INVALID_OP) or outside the range
10351035
// of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
1036-
return None
1036+
return None;
10371037
} else {
10381038
// Floating point value can be represented by the integer type after rounding.
10391039
// The INEXACT flag is ignored on purpose to allow rounding.
@@ -1051,7 +1051,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10511051
) {
10521052
// Floating point value is NaN (flagged with INVALID_OP) or outside the range
10531053
// of values of the integer type (flagged with OVERFLOW or UNDERFLOW).
1054-
return None
1054+
return None;
10551055
} else {
10561056
// Floating point value can be represented by the integer type after rounding.
10571057
// The INEXACT flag is ignored on purpose to allow rounding.

src/tools/miri/src/operator.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,16 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriInterpCx<'mir, 'tcx> {
6565
right.to_scalar().to_target_usize(self)?,
6666
self.machine.layouts.usize,
6767
);
68-
let (result, overflowing) =
69-
self.overflowing_binary_op(bin_op, &left, &right)?;
68+
let (result, overflowing) = self.overflowing_binary_op(bin_op, &left, &right)?;
7069
// Construct a new pointer with the provenance of `ptr` (the LHS).
71-
let result_ptr =
72-
Pointer::new(ptr.provenance, Size::from_bytes(result.to_scalar().to_target_usize(self)?));
73-
(ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, self), left.layout), overflowing)
70+
let result_ptr = Pointer::new(
71+
ptr.provenance,
72+
Size::from_bytes(result.to_scalar().to_target_usize(self)?),
73+
);
74+
(
75+
ImmTy::from_scalar(Scalar::from_maybe_pointer(result_ptr, self), left.layout),
76+
overflowing,
77+
)
7478
}
7579

7680
_ => span_bug!(self.cur_span(), "Invalid operator on pointers: {:?}", bin_op),

src/tools/miri/src/shims/x86/sse2.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
6161
let right = this.int_to_int_or_float(&right, twice_wide)?;
6262

6363
// Calculate left + right + 1
64-
let added = this.wrapping_binary_op(
65-
mir::BinOp::Add,
66-
&left,
67-
&right,
68-
)?;
64+
let added = this.wrapping_binary_op(mir::BinOp::Add, &left, &right)?;
6965
let added = this.wrapping_binary_op(
7066
mir::BinOp::Add,
7167
&added,
@@ -80,10 +76,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
8076
)?;
8177

8278
// Narrow back to the original type
83-
let res = this.int_to_int_or_float(
84-
&divided,
85-
dest.layout,
86-
)?;
79+
let res = this.int_to_int_or_float(&divided, dest.layout)?;
8780
this.write_immediate(*res, &dest)?;
8881
}
8982
}
@@ -110,11 +103,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
110103
let right = this.int_to_int_or_float(&right, twice_wide)?;
111104

112105
// Multiply
113-
let multiplied = this.wrapping_binary_op(
114-
mir::BinOp::Mul,
115-
&left,
116-
&right,
117-
)?;
106+
let multiplied = this.wrapping_binary_op(mir::BinOp::Mul, &left, &right)?;
118107
// Keep the high half
119108
let high = this.wrapping_binary_op(
120109
mir::BinOp::Shr,
@@ -123,10 +112,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
123112
)?;
124113

125114
// Narrow back to the original type
126-
let res = this.int_to_int_or_float(
127-
&high,
128-
dest.layout,
129-
)?;
115+
let res = this.int_to_int_or_float(&high, dest.layout)?;
130116
this.write_immediate(*res, &dest)?;
131117
}
132118
}

0 commit comments

Comments
 (0)