]> git.ozlabs.org Git - ccan/blobdiff - ccan/htable/htable.h
htable: reduce size of htable by storing perfect bitnum, not mask.
[ccan] / ccan / htable / htable.h
index bdce920b552eb0e23a5bbe53877a146decf87d81..938b43afc89ce5a6603c45761da17d26b748475e 100644 (file)
 struct htable {
        size_t (*rehash)(const void *elem, void *priv);
        void *priv;
 struct htable {
        size_t (*rehash)(const void *elem, void *priv);
        void *priv;
-       unsigned int bits;
+       unsigned int bits, perfect_bitnum;
        size_t elems, deleted;
        /* These are the bits which are the same in all pointers. */
        uintptr_t common_mask, common_bits;
        size_t elems, deleted;
        /* These are the bits which are the same in all pointers. */
        uintptr_t common_mask, common_bits;
-       uintptr_t perfect_bit;
        uintptr_t *table;
 };
 
        uintptr_t *table;
 };
 
@@ -50,7 +49,7 @@ struct htable {
  *     static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL);
  */
 #define HTABLE_INITIALIZER(name, rehash, priv)                         \
  *     static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL);
  */
 #define HTABLE_INITIALIZER(name, rehash, priv)                         \
-       { rehash, priv, 0, 0, 0, -1, 0, 0, &name.perfect_bit }
+       { rehash, priv, 0, 0, 0, 0, -1, 0, &name.common_bits }
 
 /**
  * htable_init - initialize an empty hash table.
 
 /**
  * htable_init - initialize an empty hash table.