Summary:
Added eina_hash_crc function in eina hash module to generate hash code
using crc-32.
Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewers: Sergeant_Whitespace, cedric
Subscribers: Sergeant_Whitespace, cedric
Differential Revision: https://phab.enlightenment.org/D2273
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
static inline int eina_hash_murmur3(const char *key,
int len) EINA_ARG_NONNULL(1);
+/**
+ * @brief
+ * Hash function using crc-32 algorithm and and 0xEDB88320 polynomial
+ *
+ * @param key The key to hash
+ * @param len The length of the key
+ * @return The hash value
+ */
+static inline int eina_hash_crc(const char *key,
+ int len) EINA_ARG_NONNULL(1);
+
#include "eina_inline_hash.x"
/**
#ifndef EINA_INLINE_HASH_X_
#define EINA_INLINE_HASH_X_
+#include "eina_crc.h"
+
EAPI extern unsigned int eina_seed;
/*
return _fmix32(h1);
}
+
+static inline int
+eina_hash_crc(const char *key, int len)
+{
+ unsigned int crc;
+ unsigned int seed = 0xFFFFFFFF;
+
+ crc = eina_crc(key, len, seed, EINA_TRUE);
+ return (int)crc;
+}
#endif