@@ -34,20 +34,23 @@ predicate isValidShiftConstantRange(Expr right, Type leftType) {
3434}
3535
3636predicate isSignedConstantLeftShiftException ( LShiftExpr shift ) {
37- exists ( Expr left , Expr right , NumericType leftType , int leftVal , int rightVal , int maxBit |
37+ exists (
38+ Expr left , Expr right , NumericType leftType , QlBuiltins:: BigInt leftVal , int rightVal ,
39+ int maxBit
40+ |
3841 left = shift .getLeftOperand ( ) and
3942 right = shift .getRightOperand ( ) and
4043 leftType = left .getType ( ) and
4144 isConstantExpression ( left ) and
4245 isConstantExpression ( right ) and
4346 isSignedType ( leftType ) and
4447 isValidShiftConstantRange ( right , leftType ) and
45- leftVal = left .getValue ( ) .toInt ( ) and
48+ leftVal = left .getValue ( ) .toBigInt ( ) and
4649 rightVal = right .getValue ( ) .toInt ( ) and
47- leftVal >= 0 and
50+ leftVal >= 0 . toBigInt ( ) and
4851 maxBit = leftType .getSize ( ) * 8 - 1 and
4952 // Check that no set bit is shifted into or beyond the sign bit
50- leftVal * 2 .pow ( rightVal ) < 2 .pow ( maxBit )
53+ leftVal * 2 .toBigInt ( ) . pow ( rightVal ) < 2 . toBigInt ( ) .pow ( maxBit )
5154 )
5255}
5356
@@ -111,7 +114,6 @@ where
111114 or
112115 // Shift operators - right operand must be unsigned or constant in valid range
113116 exists ( BinaryShiftOperation shift , Expr right |
114- shift = x and
115117 shift = x and
116118 right = shift .getRightOperand ( ) and
117119 not isUnsignedType ( right .getExplicitlyConverted ( ) .getType ( ) ) and
0 commit comments