You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by bl...@apache.org on 2020/03/20 12:23:05 UTC

[cassandra] branch trunk updated: ninja fix: Fix temporal operation validation check

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

blerer pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 7e739a4  ninja fix: Fix temporal operation validation check
7e739a4 is described below

commit 7e739a4fa3f49a64abb1ad2c96d0c0a6780b31e8
Author: Benjamin Lerer <b....@gmail.com>
AuthorDate: Fri Mar 20 13:17:32 2020 +0100

    ninja fix: Fix temporal operation validation check
    
    The code was obviously written by a drunk baboon.
    Not sure what crossed my mind that day but I feel pretty ashamed
    right now.
---
 src/java/org/apache/cassandra/cql3/Duration.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/java/org/apache/cassandra/cql3/Duration.java b/src/java/org/apache/cassandra/cql3/Duration.java
index 7452316..520d195 100644
--- a/src/java/org/apache/cassandra/cql3/Duration.java
+++ b/src/java/org/apache/cassandra/cql3/Duration.java
@@ -374,10 +374,7 @@ public final class Duration
      */
     public boolean hasMillisecondPrecision()
     {
-        // Checks that the duration has no data bellow milliseconds. We can do that by checking that the last
-        // 6 bits of the number of nanoseconds are all zeros. The compiler will replace the call to
-        // numberOfTrailingZeros by a TZCNT instruction.
-        return Long.numberOfTrailingZeros(getNanoseconds()) >= 6;
+        return getNanoseconds() % NANOS_PER_MILLI == 0;
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org