summaryrefslogtreecommitdiffstats
path: root/include/cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cache.h')
-rw-r--r--include/cache.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/cache.h b/include/cache.h
index 213a6eaf..b9db1a8f 100644
--- a/include/cache.h
+++ b/include/cache.h
@@ -35,4 +35,14 @@ enum cache_level_flags {
NFT_CACHE_FLUSHED = (1 << 31),
};
+static inline uint32_t djb_hash(const char *key)
+{
+ uint32_t i, hash = 5381;
+
+ for (i = 0; i < strlen(key); i++)
+ hash = ((hash << 5) + hash) + key[i];
+
+ return hash;
+}
+
#endif /* _NFT_CACHE_H_ */