You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/08/29 03:47:30 UTC

[GitHub] [orc] guiyanakuang commented on a change in pull request #886: ORC-975: Avoid double counting closestFixedBits

guiyanakuang commented on a change in pull request #886:
URL: https://github.com/apache/orc/pull/886#discussion_r697950740



##########
File path: java/core/src/java/org/apache/orc/impl/SerializationUtils.java
##########
@@ -270,8 +270,16 @@ public static BigInteger readBigInteger(InputStream input) throws IOException {
    * @return bits required to store value
    */
   public int findClosestNumBits(long value) {
-    final int numBits = 64 - Long.numberOfLeadingZeros(value);
-    return getClosestFixedBits(numBits);
+    return getClosestFixedBits(findNumBits(value));
+  }
+
+  /**
+   * Count the number of bits left after subtracting leading zeros
+   * @param value
+   * @return bits left after subtracting leading zeros
+   */
+  public int findNumBits(long value) {

Review comment:
       I've looked up some references and I still don't know what the name of the complement code to remove the high zeros is. How about `validNumBits`.




-- 
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: dev-unsubscribe@orc.apache.org

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