jpountz commented on a change in pull request #1464:
URL: https://github.com/apache/lucene-solr/pull/1464#discussion_r417888402



##########
File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDWriter.java
##########
@@ -730,6 +730,22 @@ private void rotateToTree(int nodeID, int offset, int 
count, byte[] index, List<
     return newLeafBlockFPs;
   }
 
+  private int getNumLeftLeaveNodes(int numLeaves) {
+    // return the max level for this number of leaves. If level is full it 
returns the next level
+    int maxLevel = 32 - Integer.numberOfLeadingZeros(numLeaves);

Review comment:
       is there an off-by-one error? I'd expect maxLevel to be 
`ceil(log2(numLeaves))`, which would be `32 - 
Integer.numberOfLeadingZeros(numLeaves-1)` according to 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Integer.html#numberOfLeadingZeros(int)




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to