[ 
https://issues.apache.org/jira/browse/ORC-445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709018#comment-16709018
 ] 

ASF GitHub Bot commented on ORC-445:
------------------------------------

xndai commented on a change in pull request #346: ORC-445: [C++] Code 
improvements in RLEV2Util.
URL: https://github.com/apache/orc/pull/346#discussion_r238764472
 
 

 ##########
 File path: c++/src/RLEV2Util.hh
 ##########
 @@ -23,85 +23,24 @@
 
 namespace orc {
   extern const uint32_t FBSToBitWidthMap[FixedBitSizes::SIZE];
+  extern const uint32_t ClosestFixedBitsMap[65];
+  extern const uint32_t ClosestAlignedFixedBitsMap[65];
+  extern const uint32_t BitWidthToFBSMap[65];
 
   inline uint32_t decodeBitWidth(uint32_t n) {
     return FBSToBitWidthMap[n];
   }
 
   inline uint32_t getClosestFixedBits(uint32_t n) {
-    if (n == 0) {
-      return 1;
-    }
-
-    if (n >= 1 && n <= 24) {
-      return n;
-    } else if (n <= 26) {
-      return 26;
-    } else if (n <= 28) {
-      return 28;
-    } else if (n <= 30) {
-      return 30;
-    } else if (n <= 32) {
-      return 32;
-    } else if (n <= 40) {
-      return 40;
-    } else if (n <= 48) {
-      return 48;
-    } else if (n <= 56) {
-      return 56;
-    } else {
-      return 64;
-    }
+    return ClosestFixedBitsMap[n];
 
 Review comment:
   what if n > 64?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [C++] Code improvements in RLEV2Util
> ------------------------------------
>
>                 Key: ORC-445
>                 URL: https://issues.apache.org/jira/browse/ORC-445
>             Project: ORC
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Fang Zheng
>            Priority: Minor
>
> This is a follow-up of ORC-444. The following functions in RLEV2Util.hh can 
> be optimized by replacing the if-else statements with direct array lookup:
>   inline uint32_t getClosestFixedBits(uint32_t n);
>   inline uint32_t getClosestAlignedFixedBits(uint32_t n);
>   inline uint32_t encodeBitWidth(uint32_t n);
>   inline uint32_t findClosestNumBits(int64_t value);



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to