Lines Matching refs:index

98 static inline bool ds_deque_valid_position(ds_deque_t *deque, zend_long index)  in ds_deque_valid_position()  argument
100 if (index < 0 || index >= deque->size) { in ds_deque_valid_position()
101 INDEX_OUT_OF_RANGE(index, deque->size); in ds_deque_valid_position()
215 static inline zend_long ds_deque_lookup_index(ds_deque_t *deque, zend_long index) in ds_deque_lookup_index() argument
217 return (deque->head + index) & (deque->capacity - 1); in ds_deque_lookup_index()
223 static inline zval *ds_deque_lookup(ds_deque_t *deque, zend_long index) in ds_deque_lookup() argument
225 return deque->buffer + ds_deque_lookup_index(deque, index); in ds_deque_lookup()
228 zval *ds_deque_get(ds_deque_t *deque, zend_long index) in ds_deque_get() argument
230 if ( ! ds_deque_valid_position(deque, index)) { in ds_deque_get()
234 return ds_deque_lookup(deque, index); in ds_deque_get()
237 void ds_deque_set(ds_deque_t *deque, zend_long index, zval *value) in ds_deque_set() argument
239 if (ds_deque_valid_position(deque, index)) { in ds_deque_set()
240 zval *ptr = ds_deque_lookup(deque, index); in ds_deque_set()
324 void ds_deque_remove(ds_deque_t *deque, zend_long index, zval *return_value) in ds_deque_remove() argument
326 if ( ! ds_deque_valid_position(deque, index)) { in ds_deque_remove()
331 if (index == 0) { in ds_deque_remove()
337 if (index == deque->size - 1) { in ds_deque_remove()
343 index = ds_deque_lookup_index(deque, index); in ds_deque_remove()
346 SET_AS_RETURN_AND_UNDEF(&deque->buffer[index]); in ds_deque_remove()
348 if (index < deque->tail) { in ds_deque_remove()
350 ds_deque_memmove(deque, index, index + 1, deque->tail - index); in ds_deque_remove()
358 ds_deque_memmove(deque, deque->head + 1, deque->head, index - deque->head); in ds_deque_remove()
405 zend_long index; in ds_deque_insert_va() local
433 index = ds_deque_lookup_index(deque, position); in ds_deque_insert_va()
435 if (index <= deque->tail) { in ds_deque_insert_va()
447 index -= deque->head; in ds_deque_insert_va()
454 ds_deque_memmove(deque, (index + argc), index, (deque->tail - index)); in ds_deque_insert_va()
456 dst = &deque->buffer[index]; in ds_deque_insert_va()
461 ds_deque_memmove(deque, (deque->head - argc), deque->head, (index - deque->head)); in ds_deque_insert_va()
463 dst = &deque->buffer[index - argc]; in ds_deque_insert_va()
479 zend_long index; in ds_deque_find_index() local
481 for (index = 0; index < deque->size; index++, head++) { in ds_deque_find_index()
483 return index; in ds_deque_find_index()
502 zend_long index = ds_deque_find_index(deque, value); in ds_deque_find() local
504 if (index >= 0) { in ds_deque_find()
505 ZVAL_LONG(return_value, index); in ds_deque_find()
569 bool ds_deque_index_exists(ds_deque_t *deque, zend_long index) in ds_deque_index_exists() argument
571 return index >= 0 && index < deque->size; in ds_deque_index_exists()
574 bool ds_deque_isset(ds_deque_t *deque, zend_long index, int check_empty) in ds_deque_isset() argument
576 if (!ds_deque_index_exists(deque, index)) { in ds_deque_isset()
580 return ds_zval_isset(ds_deque_lookup(deque, index), check_empty); in ds_deque_isset()
826 ds_deque_t *ds_deque_slice(ds_deque_t *deque, zend_long index, zend_long length) in ds_deque_slice() argument
828 ds_normalize_slice_args(&index, &length, deque->size); in ds_deque_slice()
837 ds_deque_push(result, ds_deque_lookup(deque, index++)); in ds_deque_slice()