Skip to content

Commit 377a131

Browse files
committed
we need signed and unsigned comparison
1 parent 699514c commit 377a131

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main/java/de/tilman_neumann/jml/base/Int128.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,20 @@ public long getLow() {
4949
return low;
5050
}
5151

52+
/**
53+
* Signed comparison with b.
54+
* @param b
55+
*/
5256
@Override
5357
public int compareTo(Int128 b) {
58+
return high != b.high ? Long.compare(high, b.high) : Long.compareUnsigned(low, b.low);
59+
}
60+
61+
/**
62+
* Unsigned comparison with b.
63+
* @param b
64+
*/
65+
public int compareUnsigned(Int128 b) {
5466
return high != b.high ? Long.compareUnsigned(high, b.high) : Long.compareUnsigned(low, b.low);
5567
}
5668

0 commit comments

Comments
 (0)