Skip to content

Commit e650ac4

Browse files
committed
simplify
1 parent 776e6e8 commit e650ac4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lucene/core/src/java/org/apache/lucene/search/DocScoreEncoder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static long encode(int docId, float score) {
3838
}
3939

4040
static long encodeIntScore(int docId, int score) {
41-
return (((long) score) << 32) | (Integer.MAX_VALUE - docId);
41+
return (((long) score) << 32) | (~docId & 0xFFFFFFFFL);
4242
}
4343

4444
static float toScore(long value) {
@@ -50,7 +50,7 @@ static int toIntScore(long value) {
5050
}
5151

5252
static int docId(long value) {
53-
return Integer.MAX_VALUE - ((int) value);
53+
return (int) ~value;
5454
}
5555

5656
static int nextUp(int intScore) {

0 commit comments

Comments
 (0)