struct cso_node {
struct cso_node *next;
- unsigned key;
void *value;
+ unsigned key;
};
struct cso_hash_iter {
struct cso_node *node;
};
-struct cso_hash_data {
+struct cso_hash {
struct cso_node *fakeNext;
struct cso_node **buckets;
+ struct cso_node *end;
int size;
short userNumBits;
short numBits;
int numBuckets;
};
-struct cso_hash {
- struct cso_hash_data data;
- struct cso_node *end;
-};
-
void cso_hash_init(struct cso_hash *hash);
void cso_hash_deinit(struct cso_hash *hash);
{
struct cso_node **node;
- if (hash->data.numBuckets) {
- node = &hash->data.buckets[akey % hash->data.numBuckets];
+ if (hash->numBuckets) {
+ node = &hash->buckets[akey % hash->numBuckets];
assert(*node == hash->end || (*node)->next);
while (*node != hash->end && (*node)->key != akey)
node = &(*node)->next;