Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Automatically exported from code.google.com/p/libhhash
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
HOPSCOTCH HASH TABLE IMPLMENTATION Hash tables are very efficient for key value lookup in both speed and memory usage. Hopscotch hash tables also provide memory locality and cache efficiency by using open addressing and a special method of linear probing. IMPLEMENTATION NOTES The neighborhood of baskets is circular going back after the last element to the first using modulo arithmetic's. Wherever we use a difference (x-y)%n, in order to keep modulo semantics using unsigned variables we add n: (n+x-y)%n, which is basically a nop but guarantees that the result of the subtraction remains positive. We are using the following GCC builtin function to calculate an integer logarithm in base 2: __builtin_clz, count-leading-zeros, returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined. BUILDING The code relies, besides the aforementioned builtins, on stdlib.h for the function malloc. TESTING Unit tests can be found from the directory test. To run them use 'make test' target. The tests do not print anything but abort if something has not been as it should. DOCUMENTATION A Unix manual page is in the directory man. This also provides the documentation for the provided functions. CONTACT Jani Lahtinen <firstname.lastname@example.org> REFERENCES Herlihy, Maurice and Shavit, Nir and Tzafrir, Moran, Hopscotch Hashing. DISC '08: Proceedings of the 22nd international symposium on Distributed Computing. Arcachon, France: Springer-Verlag. pp. 350--364, 2008.