Skip to content

Commit

Permalink
replaced some bit operations with truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
kenta7777 committed Mar 11, 2019
1 parent 4c9f7a0 commit 0ede9e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc_mir/build/matches/simplify.rs
Expand Up @@ -19,7 +19,7 @@ use rustc::ty;
use rustc::ty::layout::{Integer, IntegerExt, Size};
use syntax::attr::{SignedInt, UnsignedInt};
use rustc::hir::RangeEnd;
use rustc::mir::interpret::mask;
use rustc::mir::interpret::truncate;

use std::mem;

Expand Down Expand Up @@ -116,14 +116,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
ty::Int(ity) => {
// FIXME(49937): refactor these bit manipulations into interpret.
let size = Integer::from_attr(&tcx, SignedInt(ity)).size();
let max = mask(size);
let max = truncate(u128::max_value(), size);
let bias = 1u128 << (size.bits() - 1);
(Some((0, max, size)), bias)
}
ty::Uint(uty) => {
// FIXME(49937): refactor these bit manipulations into interpret.
let size = Integer::from_attr(&tcx, UnsignedInt(uty)).size();
let max = mask(size);
let max = truncate(u128::max_value(), size);
(Some((0, max, size)), 0)
}
_ => (None, 0),
Expand Down

0 comments on commit 0ede9e6

Please sign in to comment.