Skip to content

Commit 0ede9e6

Browse files
committed
replaced some bit operations with truncate
1 parent 4c9f7a0 commit 0ede9e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/librustc_mir/build/matches/simplify.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rustc::ty;
1919
use rustc::ty::layout::{Integer, IntegerExt, Size};
2020
use syntax::attr::{SignedInt, UnsignedInt};
2121
use rustc::hir::RangeEnd;
22-
use rustc::mir::interpret::mask;
22+
use rustc::mir::interpret::truncate;
2323

2424
use std::mem;
2525

@@ -116,14 +116,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
116116
ty::Int(ity) => {
117117
// FIXME(49937): refactor these bit manipulations into interpret.
118118
let size = Integer::from_attr(&tcx, SignedInt(ity)).size();
119-
let max = mask(size);
119+
let max = truncate(u128::max_value(), size);
120120
let bias = 1u128 << (size.bits() - 1);
121121
(Some((0, max, size)), bias)
122122
}
123123
ty::Uint(uty) => {
124124
// FIXME(49937): refactor these bit manipulations into interpret.
125125
let size = Integer::from_attr(&tcx, UnsignedInt(uty)).size();
126-
let max = mask(size);
126+
let max = truncate(u128::max_value(), size);
127127
(Some((0, max, size)), 0)
128128
}
129129
_ => (None, 0),

0 commit comments

Comments
 (0)