simplify the masked rhs computation
This commit is contained in:
parent
001ae69212
commit
c7039dbb2b
@ -82,17 +82,19 @@ fn unrelated_ptr_ops<'tcx>(bin_op: mir::BinOp) -> EvalResult<'tcx, PrimVal> {
|
||||
U64(_) => 6,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let mask = (1 << mask_bits) - 1;
|
||||
let r = match right {
|
||||
I8(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
I16(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
I32(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
I64(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
U8(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
U16(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
U32(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
U64(i) => (i & ((1 << mask_bits) - 1)) as u32,
|
||||
I8(i) => i as u8 & mask,
|
||||
I16(i) => i as u8 & mask,
|
||||
I32(i) => i as u8 & mask,
|
||||
I64(i) => i as u8 & mask,
|
||||
U8(i) => i as u8 & mask,
|
||||
U16(i) => i as u8 & mask,
|
||||
U32(i) => i as u8 & mask,
|
||||
U64(i) => i as u8 & mask,
|
||||
_ => panic!("bad MIR: bitshift rhs is not integral"),
|
||||
};
|
||||
let r = r as u32;
|
||||
macro_rules! shift {
|
||||
($v:ident, $l:ident, $r:ident) => ({
|
||||
match bin_op {
|
||||
|
Loading…
Reference in New Issue
Block a user