summaryrefslogtreecommitdiff
path: root/Zend/zend_hash.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2016-05-04 17:33:35 +0300
committerDmitry Stogov <dmitry@zend.com>2016-05-04 17:33:35 +0300
commitb91197c8a3c5689f77255722d7beb0e9786bc432 (patch)
tree9296dbab7e4ffb56782547a669762308725f763d /Zend/zend_hash.h
parentdc78e02ad240094e286174fab84881a32f58d070 (diff)
downloadphp-git-b91197c8a3c5689f77255722d7beb0e9786bc432.tar.gz
Inlined fast path
Diffstat (limited to 'Zend/zend_hash.h')
-rw-r--r--Zend/zend_hash.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index f18ce5c058..aa5dc24fd2 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -154,6 +154,26 @@ ZEND_API void ZEND_FASTCALL zend_hash_del_bucket(HashTable *ht, Bucket *p);
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
ZEND_API zval* ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *key, size_t len);
ZEND_API zval* ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h);
+ZEND_API zval* ZEND_FASTCALL _zend_hash_index_find(const HashTable *ht, zend_ulong h);
+
+#define ZEND_HASH_INDEX_FIND(_ht, _h, _ret, _not_found) do { \
+ if (EXPECTED((_ht)->u.flags & HASH_FLAG_PACKED)) { \
+ if (EXPECTED((_h) < (_ht)->nNumUsed)) { \
+ _ret = &ht->arData[_h].val; \
+ if (UNEXPECTED(Z_TYPE_P(_ret) == IS_UNDEF)) { \
+ goto _not_found; \
+ } \
+ } else { \
+ goto _not_found; \
+ } \
+ } else { \
+ _ret = _zend_hash_index_find(_ht, _h); \
+ if (UNEXPECTED(_ret == NULL)) { \
+ goto _not_found; \
+ } \
+ } \
+ } while (0)
+
/* Misc */
ZEND_API zend_bool ZEND_FASTCALL zend_hash_exists(const HashTable *ht, zend_string *key);