Changeset 359 for trunk/xcache.c


Ignore:
Timestamp:
2007-03-01T11:55:04+01:00 (8 years ago)
Author:
moo
Message:

merged from 1.2: fix for #71, fix inode hvalue issue by better hashing

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/xcache.c

    r353 r359  
    729729#define HASH_STR(s) HASH_STR_L(s, strlen(s) + 1)
    730730#define HASH_NUM(n) HASH(n)
     731static inline xc_hash_value_t xc_hash_fold(xc_hash_value_t hvalue, const xc_hash_t *hasher) /* {{{ fold hash bits as needed */
     732{
     733    xc_hash_value_t folded = 0;
     734    while (hvalue) {
     735        folded ^= (hvalue & hasher->mask);
     736        hvalue >>= hasher->bits;
     737    }
     738    return folded;
     739}
     740/* }}} */
    731741static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *xce TSRMLS_DC) /* {{{ */
    732742{
     
    843853
    844854    hv = xc_entry_hash_php(xce TSRMLS_CC);
    845     cacheid = (hv & xc_php_hcache.mask);
     855    cacheid = xc_hash_fold(hv, &xc_php_hcache);
    846856    xce->cache = xc_php_caches[cacheid];
    847     hv >>= xc_php_hcache.bits;
    848     xce->hvalue = (hv & xc_php_hentry.mask);
     857    xce->hvalue = xc_hash_fold(hv, &xc_php_hentry);
    849858
    850859    xce->type = XC_TYPE_PHP;
Note: See TracChangeset for help on using the changeset viewer.