summaryrefslogtreecommitdiffstats
path: root/src/hash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hash.h b/src/hash.h
index 7a47388..7a8c79b 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -23,6 +23,14 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ \file
+
+ An implementation of the Jenkins hash function
+
+ \sa https://en.wikipedia.org/wiki/Jenkins_hash_function
+*/
+
#pragma once
@@ -31,6 +39,7 @@
#include <stdint.h>
+/** Adds data bytes to the 32bit hash value */
static inline void fastd_hash(uint32_t *hash, const void *data, size_t len) {
size_t i;
for (i = 0; i < len; ++i) {
@@ -40,6 +49,7 @@ static inline void fastd_hash(uint32_t *hash, const void *data, size_t len) {
}
}
+/** Finalizes a hash value */
static inline void fastd_hash_final(uint32_t *hash) {
*hash += (*hash << 3);
*hash ^= (*hash >> 11);