Skip to content

Commit

Permalink
Do not skip elements >= (1 << 48) w/o checking for sentinel (#814)
Browse files Browse the repository at this point in the history
Fixes issue where scan would not terminate when one of the sentinel
values is outside the 48 bit range (shard->params.last >= (1 << 48)).
  • Loading branch information
droe committed Mar 9, 2024
1 parent 118538b commit 8a2583d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/shard.c
Expand Up @@ -157,10 +157,8 @@ target_t shard_get_cur_target(shard_t *shard)

static inline uint64_t shard_get_next_elem(shard_t *shard)
{
do {
shard->current *= shard->params.factor;
shard->current %= shard->params.modulus;
} while (shard->current >= (1LL << 48));
shard->current *= shard->params.factor;
shard->current %= shard->params.modulus;
return (uint64_t)shard->current;
}

Expand Down

0 comments on commit 8a2583d

Please sign in to comment.