summaryrefslogtreecommitdiffhomepage
path: root/include/stc/crandom.h
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-07-15 00:19:40 +0200
committerTyge Lovset <[email protected]>2022-07-15 00:19:40 +0200
commit293af54c54a4864f80ad3f9520ad4d2f85723aa1 (patch)
tree638e6dcd113eb0026942c121b09c74d909d22d43 /include/stc/crandom.h
parent839efba934c8623f2dea31e7f8bb2857624c6908 (diff)
downloadSTC-modified-293af54c54a4864f80ad3f9520ad4d2f85723aa1.tar.gz
STC-modified-293af54c54a4864f80ad3f9520ad4d2f85723aa1.zip
cmap: No longer uses c_umul128. If `i_size` is defined by user, table is power of 2 length and bit-masking used for mapping hash to index.
Diffstat (limited to 'include/stc/crandom.h')
-rw-r--r--include/stc/crandom.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/stc/crandom.h b/include/stc/crandom.h
index e99be1ca..06964a5d 100644
--- a/include/stc/crandom.h
+++ b/include/stc/crandom.h
@@ -150,7 +150,7 @@ STC_DEF stc64_t stc64_with_seq(uint64_t seed, uint64_t seq) {
/* Init unbiased uniform uint RNG with bounds [low, high] */
STC_DEF stc64_uniform_t stc64_uniform_new(int64_t low, int64_t high) {
stc64_uniform_t dist = {low, (uint64_t) (high - low + 1)};
- dist.threshold = (uint64_t)-(int64_t)dist.range % dist.range;
+ dist.threshold = (uint64_t)(0 - dist.range) % dist.range;
return dist;
}