Created
January 4, 2012 14:53
-
-
Save rbriank/1560362 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \ | |
((ptr) != 0 && (ptr->hash != (hash_val) || !EQUAL((table), (key), (ptr)->key))) | |
#ifdef HASH_LOG | |
#define COLLISION collision++ | |
#else | |
#define COLLISION | |
#endif | |
#define FIND_ENTRY(table, ptr, hash_val, bin_pos) do {\ | |
bin_pos = hash_val%(table)->num_bins;\ | |
ptr = (table)->bins[bin_pos];\ | |
if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\ | |
COLLISION;\ | |
while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\ | |
ptr = ptr->next;\ | |
}\ | |
ptr = ptr->next;\ | |
}\ | |
} while (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment