Skip to content

Commit 341314f

Browse files
committed
Sonarqube: Only the sign of the result should be examined
1 parent 65cbcd9 commit 341314f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/ints/IntBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ public PBytes fromPIntInt(PInt self, int byteCount, String byteorder, PNone sign
17861786

17871787
@TruffleBoundary
17881788
private byte getSingByte(BigInteger value, boolean signed) {
1789-
if (value.compareTo(BigInteger.ZERO) == -1) {
1789+
if (value.compareTo(BigInteger.ZERO) < 0) {
17901790
if (!signed) {
17911791
throw raise(PythonErrorType.OverflowError, MESSAGE_CONVERT_NEGATIVE);
17921792
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list/ListBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ public PNone insert(PList list, Object i, Object value,
390390
private static int normalizePIntForIndex(PInt index) {
391391
int where = 0;
392392
BigInteger bigIndex = index.getValue();
393-
if (bigIndex.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) == -1) {
393+
if (bigIndex.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) < 0) {
394394
where = 0;
395-
} else if (bigIndex.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
395+
} else if (bigIndex.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) > 0) {
396396
where = Integer.MAX_VALUE;
397397
} else {
398398
where = bigIndex.intValue();

0 commit comments

Comments
 (0)