This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/master by this push:
     new 10bb583  ORC-456: [C++] Simplify code logic in RleEncoderV2::write().
10bb583 is described below

commit 10bb583933551fc0faea722d0345c00d86a5a6e0
Author: Fang Zheng <[email protected]>
AuthorDate: Fri Jan 11 14:56:16 2019 -0800

    ORC-456: [C++] Simplify code logic in RleEncoderV2::write().
    
    Fixes #355
    
    Signed-off-by: Gang Wu <[email protected]>
---
 c++/src/RleEncoderV2.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/c++/src/RleEncoderV2.cc b/c++/src/RleEncoderV2.cc
index c5c7860..51cf4c9 100644
--- a/c++/src/RleEncoderV2.cc
+++ b/c++/src/RleEncoderV2.cc
@@ -133,16 +133,14 @@ void RleEncoderV2::write(int64_t val) {
             numLiterals -= MIN_REPEAT;
             variableRunLength -= (MIN_REPEAT - 1);
 
-            int64_t tailVals[MIN_REPEAT] = {0};
-
-            memcpy(tailVals, literals + numLiterals, sizeof(int64_t) * 
MIN_REPEAT);
             determineEncoding(option);
             writeValues(option);
 
             // shift tail fixed runs to beginning of the buffer
             for (size_t i = 0; i < MIN_REPEAT; ++i) {
-                literals[numLiterals++] = tailVals[i];
+                literals[i] = val;
             }
+            numLiterals = MIN_REPEAT;
         }
 
         if (fixedRunLength == MAX_LITERAL_SIZE) {;

Reply via email to