From a088f105aa2e099ba027e47f9bc29c30b06b416e Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 20 Jun 2016 17:52:14 +0200 Subject: [PATCH] add a comment explaining the magic numbers --- src/primval.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/primval.rs b/src/primval.rs index 586aaeee4e92..29d79abbbfc4 100644 --- a/src/primval.rs +++ b/src/primval.rs @@ -69,6 +69,8 @@ pub fn binary_op<'tcx>(bin_op: mir::BinOp, left: PrimVal, right: PrimVal) -> Eva match bin_op { // can have rhs with a different numeric type Shl | Shr => { + // these numbers are the maximum number of bits a bitshift rhs could possibly have + // e.g. u16 can be bitshifted by 0..16, so 2^4 - 1 is the largest possible bitshift let mask_bits = match left { I8(_) => 3, I16(_) => 4,