You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by md...@apache.org on 2018/07/29 22:29:14 UTC

orc git commit: ORC-388: Fix isSafeSubtract to use logic operator instead of bit operator

Repository: orc
Updated Branches:
  refs/heads/master 7b10d82de -> 0dd6c1fe9


ORC-388: Fix isSafeSubtract to use logic operator instead of bit operator

Fixes #293

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


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

Branch: refs/heads/master
Commit: 0dd6c1fe9c5d1c7a3c7b80be8f9413c397a7f907
Parents: 7b10d82
Author: Gang Wu <ga...@alibaba-inc.com>
Authored: Tue Jul 24 13:35:19 2018 -0700
Committer: Deepak Majeti <md...@apache.org>
Committed: Sun Jul 29 18:28:47 2018 -0400

----------------------------------------------------------------------
 c++/src/RLEV2Util.hh                                           | 2 +-
 java/core/src/java/org/apache/orc/impl/SerializationUtils.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/0dd6c1fe/c++/src/RLEV2Util.hh
----------------------------------------------------------------------
diff --git a/c++/src/RLEV2Util.hh b/c++/src/RLEV2Util.hh
index 7928c17..a7bc553 100644
--- a/c++/src/RLEV2Util.hh
+++ b/c++/src/RLEV2Util.hh
@@ -134,7 +134,7 @@ namespace orc {
   }
 
   inline bool isSafeSubtract(int64_t left, int64_t right) {
-    return ((left ^ right) >= 0) | ((left ^ (left - right)) >= 0);
+    return ((left ^ right) >= 0) || ((left ^ (left - right)) >= 0);
   }
 
   inline uint32_t RleEncoderV2::getOpCode(EncodingType encoding) {

http://git-wip-us.apache.org/repos/asf/orc/blob/0dd6c1fe/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
----------------------------------------------------------------------
diff --git a/java/core/src/java/org/apache/orc/impl/SerializationUtils.java b/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
index 3bed475..c1a37a7 100644
--- a/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
+++ b/java/core/src/java/org/apache/orc/impl/SerializationUtils.java
@@ -1309,7 +1309,7 @@ public final class SerializationUtils {
   // Do not want to use Guava LongMath.checkedSubtract() here as it will throw
   // ArithmeticException in case of overflow
   public boolean isSafeSubtract(long left, long right) {
-    return (left ^ right) >= 0 | (left ^ (left - right)) >= 0;
+    return (left ^ right) >= 0 || (left ^ (left - right)) >= 0;
   }
 
   public static long convertFromUtc(TimeZone local, long time) {