msokolov commented on code in PR #873:
URL: https://github.com/apache/lucene/pull/873#discussion_r872437351


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/NeighborQueue.java:
##########
@@ -90,26 +92,30 @@ public boolean insertWithOverflow(int newNode, float 
newScore) {
   }
 
   private long encode(int node, float score) {
-    return order.apply((((long) NumericUtils.floatToSortableInt(score)) << 32) 
| node);
+    long nodeReverse = reversed ? node : (-1 - node);
+    // make sure all high 32 bits were 0 by unsigned right shift

Review Comment:
   perhaps a bitmask would be clearer? `nodeReverse &= 0xffffffff`



##########
lucene/core/src/java/org/apache/lucene/util/LongHeap.java:
##########
@@ -74,9 +74,9 @@ public final long push(long element) {
    * @return whether the value was added (unless the heap is full, or the new 
value is less than the
    *     top value)
    */
-  public boolean insertWithOverflow(long value) {
+  public final boolean insertWithOverflow(long value) {
     if (size >= maxSize) {
-      if (value < heap[1]) {
+      if ((value < heap[1])) {

Review Comment:
   don't need the extra parens



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to