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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 93d78be3 Ninja for CASSANDRA-21077: Cassandra expets setRange(0, 0) to 
not fail when the bitset is empty, so have to check for this case first before 
validating the input
93d78be3 is described below

commit 93d78be37ef904118da2426716b5d77c0fb227db
Author: David Capwell <[email protected]>
AuthorDate: Wed Jan 7 14:23:57 2026 -0800

    Ninja for CASSANDRA-21077: Cassandra expets setRange(0, 0) to not fail when 
the bitset is empty, so have to check for this case first before validating the 
input
---
 accord-core/src/main/java/accord/utils/LargeBitSet.java | 4 ++--
 accord-core/src/main/java/accord/utils/SmallBitSet.java | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/accord-core/src/main/java/accord/utils/LargeBitSet.java 
b/accord-core/src/main/java/accord/utils/LargeBitSet.java
index 60a07438..39dc342c 100644
--- a/accord-core/src/main/java/accord/utils/LargeBitSet.java
+++ b/accord-core/src/main/java/accord/utils/LargeBitSet.java
@@ -102,11 +102,11 @@ public class LargeBitSet implements SimpleBitSet
     @Override
     public void setRange(int fromInclusive, int toExclusive)
     {
+        if (fromInclusive == toExclusive)
+            return;
         int fromIndex = indexOf(fromInclusive);  // validates input so call 
early
         validateExclusive(toExclusive);
         Invariants.requireArgument(fromInclusive <= toExclusive, "from > to 
(%s > %s)", fromInclusive, toExclusive);
-        if (fromInclusive == toExclusive)
-            return;
 
         int toIndex = (toExclusive + 63) >>> 6;
         if (fromIndex + 1 == toIndex)
diff --git a/accord-core/src/main/java/accord/utils/SmallBitSet.java 
b/accord-core/src/main/java/accord/utils/SmallBitSet.java
index e4cdeb64..4a4e7560 100644
--- a/accord-core/src/main/java/accord/utils/SmallBitSet.java
+++ b/accord-core/src/main/java/accord/utils/SmallBitSet.java
@@ -69,11 +69,11 @@ public class SmallBitSet implements SimpleBitSet
     @Override
     public void setRange(int fromInclusive, int toExclusive)
     {
+        if (fromInclusive == toExclusive)
+            return;
         validateInclusive(fromInclusive);
         validateExclusive(toExclusive);
         Invariants.requireArgument(fromInclusive <= toExclusive, "from > to 
(%s > %s)", fromInclusive, toExclusive);
-        if (fromInclusive == toExclusive)
-            return;
 
         bits |= (-1L >>> (64 - (toExclusive & 63))) & (-1L << (fromInclusive & 
63));
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to