[PHP] PHP哈希表结构的深入剖析 →→→→→进入此内容的聊天室

来自 , 2019-06-04, 写在 PHP, 查看 106 次.
URL http://www.code666.cn/view/f42c7f9c
  1. ZEND_API int zend_hash_exists(const HashTable *ht, const char *arKey, uint nKeyLength)
  2. {
  3.         ulong h;
  4.         uint nIndex;
  5.         Bucket *p;
  6.  
  7.         IS_CONSISTENT(ht);
  8.  
  9.         h = zend_inline_hash_func(arKey, nKeyLength);
  10.         nIndex = h & ht->nTableMask;
  11.  
  12.         p = ht->arBuckets[nIndex];
  13.         while (p != NULL) {
  14.                 if (p->arKey == arKey ||
  15.                         ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey, arKey, nKeyLength))) {
  16.                                 return 1;
  17.                 }
  18.                 p = p->pNext;
  19.         }
  20.         return 0;
  21. }
  22.  

回复 "PHP哈希表结构的深入剖析"

这儿你可以回复上面这条便签

captcha