@@ -1185,11 +1185,20 @@ Object doLLOvf(long left, long right) {
1185
1185
}
1186
1186
}
1187
1187
1188
- @ Specialization
1188
+ @ Specialization (guards = {"left == 0" , "right.isZeroOrPositive()" })
1189
+ static int doLPiZero (@ SuppressWarnings ("unused" ) long left , @ SuppressWarnings ("unused" ) PInt right ) {
1190
+ return 0 ;
1191
+ }
1192
+
1193
+ @ Specialization (replaces = "doLPiZero" )
1189
1194
PInt doLPi (long left , PInt right ) {
1190
1195
raiseNegativeShiftCount (!right .isZeroOrPositive ());
1196
+ if (left == 0 ) {
1197
+ return factory ().createInt (BigInteger .ZERO );
1198
+ }
1191
1199
try {
1192
- return factory ().createInt (op (PInt .longToBigInteger (left ), right .intValueExact ()));
1200
+ int iright = right .intValueExact ();
1201
+ return factory ().createInt (op (PInt .longToBigInteger (left ), iright ));
1193
1202
} catch (ArithmeticException e ) {
1194
1203
throw raise (PythonErrorType .OverflowError );
1195
1204
}
@@ -1219,9 +1228,17 @@ PInt doPiL(PInt left, long right) {
1219
1228
}
1220
1229
}
1221
1230
1222
- @ Specialization
1231
+ @ Specialization (guards = {"left.isZero()" , "right.isZeroOrPositive()" })
1232
+ static int doPiPiZero (@ SuppressWarnings ("unused" ) PInt left , @ SuppressWarnings ("unused" ) PInt right ) {
1233
+ return 0 ;
1234
+ }
1235
+
1236
+ @ Specialization (replaces = "doPiPiZero" )
1223
1237
PInt doPiPi (PInt left , PInt right ) {
1224
1238
raiseNegativeShiftCount (!right .isZeroOrPositive ());
1239
+ if (left .isZero ()) {
1240
+ return factory ().createInt (BigInteger .ZERO );
1241
+ }
1225
1242
try {
1226
1243
return factory ().createInt (op (left .getValue (), right .intValueExact ()));
1227
1244
} catch (ArithmeticException e ) {
0 commit comments