https://github.com/williamsdevaccount/libhhash
Automatically exported from code.google.com/p/libhhash
https://github.com/williamsdevaccount/libhhash
Last synced: over 1 year ago
JSON representation
Automatically exported from code.google.com/p/libhhash
- Host: GitHub
- URL: https://github.com/williamsdevaccount/libhhash
- Owner: williamsdevaccount
- License: mit
- Created: 2015-07-25T20:49:58.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-25T20:52:31.000Z (almost 11 years ago)
- Last Synced: 2024-04-16T12:48:57.906Z (about 2 years ago)
- Language: C
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
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 methdod of
linear probing.
IMPLEMENTATIOON NOTES
The neighbourhood of baskets is circular going back after the last
element to the first using modulo arithmetics. Whereever 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
logartihm 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. The provided mkfile is written for Plan 9 mk which is
provided on other platforms by the Plan 9 Ports [2]. If Plan9port is
available to get the library compiled and, optionally installed, use
'mk [install]'.
The environment variables needed to install are in mkconfig, which is
a Plan 9 RC script. The variable BASE referes to the base directory of
this library. If you use BASH shell, you can use mkconfig.sh instead.
TESTING
Unit tests can be found from the directory ut. The associated mkfile
is contained within as is the documentation of them. The header
9unit.h is our entire unit test library and is included here. The
script check runs executables and prints either "pass" or "FAIL" with
obvious semantics depending on the return value of the executed test.
DOCUMENTATION
A Unix manual page is in the directory man. This also provides the
documentation for the provided functions.
CONTACT
Jani Lahtinen
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.