summaryrefslogtreecommitdiff
path: root/lib/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hash.h')
-rw-r--r--lib/hash.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/hash.h b/lib/hash.h
index a73f647a..fc5fea14 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -2,7 +2,7 @@
#define HASH(type) struct { type **data; uint count, order; }
#define HASH_TYPE(v) typeof(** (v).data)
-#define HASH_SIZE(v) (1 << (v).order)
+#define HASH_SIZE(v) (1U << (v).order)
#define HASH_EQ(v,id,k1,k2...) (id##_EQ(k1, k2))
#define HASH_FN(v,id,key...) ((u32) (id##_FN(key)) >> (32 - (v).order))
@@ -116,12 +116,12 @@
#define HASH_MAY_RESIZE_DOWN_(v,pool,rehash_fn,args) \
({ \
- int _o = (v).order; \
- while (((v).count < ((1 << _o) REHASH_LO_MARK(args))) && \
+ uint _o = (v).order; \
+ while (((v).count < ((1U << _o) REHASH_LO_MARK(args))) && \
(_o > (REHASH_LO_BOUND(args)))) \
_o -= (REHASH_LO_STEP(args)); \
if (_o < (v).order) \
- rehash_fn(&(v), pool, _o - (int) (v).order); \
+ rehash_fn(&(v), pool, _o - (v).order); \
})