ifesdjeen commented on code in PR #263:
URL: https://github.com/apache/cassandra-accord/pull/263#discussion_r2619546417
##########
accord-core/src/main/java/accord/topology/Topology.java:
##########
@@ -560,22 +578,29 @@ public <P, T> T foldlWithDefault(Routables<?> select,
IndexedTriFunction<Shard,
{
Routables<?> as = select;
Ranges bs = subsetOfRanges;
- int ai = 0, amax = 0, bi = 0;
+ int ai = 0, bi = 0;
while (true)
{
long abi = as.findNextIntersection(ai, bs, bi);
if (abi < 0)
+ {
+ if (ai < as.size())
+ accumulator = function.apply(ifNull, param, accumulator,
-1 - bs.size());
break;
+ }
int nextai = (int)(abi);
bi = (int)(abi >>> 32);
- if (nextai > amax + 1)
- accumulator = function.apply(null, param, accumulator, -1 -
bi);
+ if (nextai > ai)
+ accumulator = function.apply(ifNull, param, accumulator, -1 -
bi);
accumulator = function.apply(shards[supersetIndexes[bi]], param,
accumulator, bi);
- amax = nextai + 1;
- ai = nextai;
+
+ Range r = ranges.get(bi);
Review Comment:
Can we use `bi` here to address `ranges` not `subsetOfRanges`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]