Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created September 7, 2009 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/182170 to your computer and use it in GitHub Desktop.
Save anonymous/182170 to your computer and use it in GitHub Desktop.
--- APC-3.0.19,orig/apc_cache.c 2008-05-15 15:45:27.000000000 +0900
+++ APC-3.0.19/apc_cache.c 2009-09-03 11:54:13.900595000 +0900
@@ -62,24 +62,7 @@
/* }}} */
/* {{{ string_nhash_8 */
-static unsigned int string_nhash_8(const char *s, size_t len)
-{
- register const unsigned int *iv = (const unsigned int *)s;
- register unsigned int h = 0;
- register const unsigned int *e = (const unsigned int *)(s + len - (len % sizeof(unsigned int)));
-
- for(;iv<e;iv++) {
- h += *iv;
- h = (h << 7) | (h >> ((8*sizeof(unsigned int)) - 7));
- }
- s = (const char *)iv;
- for(len %= sizeof(unsigned int);len;len--) {
- h += *(s++);
- }
- h ^= (h >> 13);
- h ^= (h >> 7);
- return h;
-}
+#define string_nhash_8(s,len) (unsigned int)(zend_inline_hash_func(s, len))
/* }}} */
/* {{{ make_slot */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment