summaryrefslogtreecommitdiffstats
path: root/src/hash.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-29 05:00:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-29 05:00:11 +0200
commit2fe678653b7dd9f61dbbcd5e7d862360882bd7e8 (patch)
tree38c9dabad94845e848373b15788fcd7ae089218e /src/hash.h
parentefcafca969d2e789cdf106609b04a86ef9b53a3d (diff)
downloadfastd-2fe678653b7dd9f61dbbcd5e7d862360882bd7e8.tar
fastd-2fe678653b7dd9f61dbbcd5e7d862360882bd7e8.zip
Document *everything*
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);