summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.h
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2001-07-11 16:16:08 +0000
committerAndi Gutmans <andi@php.net>2001-07-11 16:16:08 +0000
commitb98acd61f1074cb8b1818b5f2d4d5527a7619fdd (patch)
tree1149f8d2cc644476afe7a143e92bc446d283cb77 /Zend/zend_hash.h
parent5676e5ad05b3b506f78f9ab3115b162dcc938188 (diff)
downloadphp-git-b98acd61f1074cb8b1818b5f2d4d5527a7619fdd.tar.gz
- Move inline_zend_hash_func() to header file
Diffstat (limited to 'Zend/zend_hash.h')
-rw-r--r--Zend/zend_hash.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 8f0303948c..7b34ee5729 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -180,7 +180,18 @@ ZEND_API int zend_hash_num_elements(HashTable *ht);
ZEND_API int zend_hash_rehash(HashTable *ht);
-/* ZEND_API ulong hashpjw(char *arKey, uint nKeyLength); */
+static inline ulong zend_inline_hash_func(char *arKey, uint nKeyLength)
+{
+ ulong h = 5381;
+ char *arEnd = arKey + nKeyLength;
+
+ while (arKey < arEnd) {
+ h += (h << 5);
+ h ^= (ulong) *arKey++;
+ }
+ return h;
+}
+
ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength);
#if ZEND_DEBUG