Lines Matching refs:nSize
114 static zend_always_inline uint32_t zend_hash_check_size(uint32_t nSize) in zend_hash_check_size() argument
122 if (nSize <= HT_MIN_SIZE) { in zend_hash_check_size()
124 } else if (UNEXPECTED(nSize > HT_MAX_SIZE)) { in zend_hash_check_size()
125 …ERROR, "Possible integer overflow in memory allocation (%u * %zu + %zu)", nSize, sizeof(Bucket), s… in zend_hash_check_size()
129 if (BitScanReverse(&index, nSize - 1)) { in zend_hash_check_size()
134 return nSize; in zend_hash_check_size()
137 return 0x2u << (__builtin_clz(nSize - 1) ^ 0x1f); in zend_hash_check_size()
139 nSize -= 1; in zend_hash_check_size()
140 nSize |= (nSize >> 1); in zend_hash_check_size()
141 nSize |= (nSize >> 2); in zend_hash_check_size()
142 nSize |= (nSize >> 4); in zend_hash_check_size()
143 nSize |= (nSize >> 8); in zend_hash_check_size()
144 nSize |= (nSize >> 16); in zend_hash_check_size()
145 return nSize + 1; in zend_hash_check_size()
170 uint32_t nSize = ht->nTableSize; in zend_hash_real_init_mixed_ex() local
172 ZEND_ASSERT(HT_SIZE_TO_MASK(nSize)); in zend_hash_real_init_mixed_ex()
175 data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), 1); in zend_hash_real_init_mixed_ex()
176 } else if (EXPECTED(nSize == HT_MIN_SIZE)) { in zend_hash_real_init_mixed_ex()
226 data = emalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize))); in zend_hash_real_init_mixed_ex()
228 ht->nTableMask = HT_SIZE_TO_MASK(nSize); in zend_hash_real_init_mixed_ex()
262 static zend_always_inline void _zend_hash_init_int(HashTable *ht, uint32_t nSize, dtor_func_t pDest… in _zend_hash_init_int() argument
274 ht->nTableSize = zend_hash_check_size(nSize); in _zend_hash_init_int()
277 ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor,… in _zend_hash_init() argument
279 _zend_hash_init_int(ht, nSize, pDestructor, persistent); in _zend_hash_init()
289 ZEND_API HashTable* ZEND_FASTCALL _zend_new_array(uint32_t nSize) in _zend_new_array() argument
292 _zend_hash_init_int(ht, nSize, ZVAL_PTR_DTOR, 0); in _zend_new_array()
352 uint32_t nSize = ht->nTableSize; in zend_hash_packed_to_hash() local
354 ZEND_ASSERT(HT_SIZE_TO_MASK(nSize)); in zend_hash_packed_to_hash()
358 new_data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), GC_FLAGS(ht) & IS_ARRAY_PERSISTENT); in zend_hash_packed_to_hash()
396 ZEND_API void ZEND_FASTCALL zend_hash_extend(HashTable *ht, uint32_t nSize, bool packed) in zend_hash_extend() argument
400 if (nSize == 0) return; in zend_hash_extend()
402 ZEND_ASSERT(HT_SIZE_TO_MASK(nSize)); in zend_hash_extend()
405 if (nSize > ht->nTableSize) { in zend_hash_extend()
406 ht->nTableSize = zend_hash_check_size(nSize); in zend_hash_extend()
412 if (nSize > ht->nTableSize) { in zend_hash_extend()
413 uint32_t newTableSize = zend_hash_check_size(nSize); in zend_hash_extend()
419 if (nSize > ht->nTableSize) { in zend_hash_extend()
422 nSize = zend_hash_check_size(nSize); in zend_hash_extend()
423 …new_data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), GC_FLAGS(ht) & IS_ARRAY_PERSISTENT); in zend_hash_extend()
424 ht->nTableSize = nSize; in zend_hash_extend()
1311 uint32_t nSize = ht->nTableSize + ht->nTableSize; in zend_hash_do_resize() local
1314 ZEND_ASSERT(HT_SIZE_TO_MASK(nSize)); in zend_hash_do_resize()
1316 …new_data = pemalloc(HT_SIZE_EX(nSize, HT_SIZE_TO_MASK(nSize)), GC_FLAGS(ht) & IS_ARRAY_PERSISTENT); in zend_hash_do_resize()
1317 ht->nTableSize = nSize; in zend_hash_do_resize()