summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmap.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmap.h b/cmap.h
index 5ec158ec..0ec86672 100644
--- a/cmap.h
+++ b/cmap.h
@@ -134,7 +134,7 @@ static inline size_t cmap_##tag##_bucket(CMap_##tag cm, KeyRaw rawKey) { \
cdef_swap(CMapEntry_##tag, cm._vec.data[erased_idx], cm._vec.data[idx]); \
return erased_idx; \
} \
- return idx; \
+ return idx; \
case CMapEntry_ERASED: \
if (erased_idx == cap) erased_idx = idx; \
break; \
@@ -215,6 +215,7 @@ typedef Value cmap_##tag##_value_t
#define FIBONACCI_DECL size_t fib1 = 0, fib2 = 1, fibx
#define FIBONACCI_NEXT (fibx = fib1 + fib2, fib1 = fib2, fib2 = fibx)
+// https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
static inline uint32_t cmap_reduce(uint32_t x, uint32_t N) {
return ((uint64_t) x * (uint64_t) N) >> 32 ;
}