Repository: orc
Updated Branches:
  refs/heads/master 21a05eea8 -> 84fa2ff28


ORC-293: [C++] Fix RleEncoderV1 for case when sizeof(long) < sizeof(int64_t)

Fixes #212

Signed-off-by: Deepak Majeti <mdee...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/84fa2ff2
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/84fa2ff2
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/84fa2ff2

Branch: refs/heads/master
Commit: 84fa2ff28671f6eab2e4469674d4e69705b420e6
Parents: 21a05ee
Author: rip-nsk <rip....@gmail.com>
Authored: Fri Jan 19 15:03:33 2018 -0800
Committer: Deepak Majeti <mdee...@apache.org>
Committed: Mon Feb 19 19:43:42 2018 -0500

----------------------------------------------------------------------
 c++/src/RLEv1.cc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/84fa2ff2/c++/src/RLEv1.cc
----------------------------------------------------------------------
diff --git a/c++/src/RLEv1.cc b/c++/src/RLEv1.cc
index ce1af22..e588e6a 100644
--- a/c++/src/RLEv1.cc
+++ b/c++/src/RLEv1.cc
@@ -28,7 +28,7 @@ namespace orc {
 const int MINIMUM_REPEAT = 3;
 const int MAXIMUM_REPEAT = 127 + MINIMUM_REPEAT;
 
-const int BASE_128_MASK = 0x7f;
+const int64_t BASE_128_MASK = 0x7f;
 
 const int MAX_DELTA = 127;
 const int MIN_DELTA = -128;
@@ -148,7 +148,7 @@ void RleEncoderV1::write(int64_t value) {
         numLiterals += 1;
       } else {
         numLiterals -= static_cast<int>(MINIMUM_REPEAT - 1);
-        long base = literals[numLiterals];
+        int64_t base = literals[numLiterals];
         writeValues();
         literals[0] = base;
         repeat = true;
@@ -169,11 +169,11 @@ void RleEncoderV1::writeVslong(int64_t val) {
 
 void RleEncoderV1::writeVulong(int64_t val) {
   while (true) {
-    if ((val & ~0x7f) == 0) {
+    if ((val & ~BASE_128_MASK) == 0) {
       writeByte(static_cast<char>(val));
       return;
     } else {
-      writeByte(static_cast<char>(0x80 | (val & 0x7f)));
+      writeByte(static_cast<char>(0x80 | (val & BASE_128_MASK)));
       // cast val to unsigned so as to force 0-fill right shift
       val = (static_cast<uint64_t>(val) >> 7);
     }

Reply via email to