Lines Matching full:size

49 static inline unsigned eytzinger1_first(unsigned size)  in eytzinger1_first()  argument
51 return size ? rounddown_pow_of_two(size) : 0; in eytzinger1_first()
54 static inline unsigned eytzinger1_last(unsigned size) in eytzinger1_last() argument
56 return rounddown_pow_of_two(size + 1) - 1; in eytzinger1_last()
69 static inline unsigned eytzinger1_next(unsigned i, unsigned size) in eytzinger1_next() argument
71 EYTZINGER_BUG_ON(i > size); in eytzinger1_next()
73 if (eytzinger1_right_child(i) <= size) { in eytzinger1_next()
76 i <<= __fls(size + 1) - __fls(i); in eytzinger1_next()
77 i >>= i > size; in eytzinger1_next()
85 static inline unsigned eytzinger1_prev(unsigned i, unsigned size) in eytzinger1_prev() argument
87 EYTZINGER_BUG_ON(i > size); in eytzinger1_prev()
89 if (eytzinger1_left_child(i) <= size) { in eytzinger1_prev()
92 i <<= __fls(size + 1) - __fls(i); in eytzinger1_prev()
94 i >>= i > size; in eytzinger1_prev()
102 static inline unsigned eytzinger1_extra(unsigned size) in eytzinger1_extra() argument
104 return size in eytzinger1_extra()
105 ? (size + 1 - rounddown_pow_of_two(size)) << 1 in eytzinger1_extra()
109 static inline unsigned __eytzinger1_to_inorder(unsigned i, unsigned size, in __eytzinger1_to_inorder() argument
113 unsigned shift = __fls(size) - b; in __eytzinger1_to_inorder()
116 EYTZINGER_BUG_ON(!i || i > size); in __eytzinger1_to_inorder()
135 static inline unsigned __inorder_to_eytzinger1(unsigned i, unsigned size, in __inorder_to_eytzinger1() argument
141 EYTZINGER_BUG_ON(!i || i > size); in __inorder_to_eytzinger1()
155 i |= 1U << (__fls(size) - shift); in __inorder_to_eytzinger1()
160 static inline unsigned eytzinger1_to_inorder(unsigned i, unsigned size) in eytzinger1_to_inorder() argument
162 return __eytzinger1_to_inorder(i, size, eytzinger1_extra(size)); in eytzinger1_to_inorder()
165 static inline unsigned inorder_to_eytzinger1(unsigned i, unsigned size) in inorder_to_eytzinger1() argument
167 return __inorder_to_eytzinger1(i, size, eytzinger1_extra(size)); in inorder_to_eytzinger1()
194 static inline unsigned eytzinger0_first(unsigned size) in eytzinger0_first() argument
196 return eytzinger1_first(size) - 1; in eytzinger0_first()
199 static inline unsigned eytzinger0_last(unsigned size) in eytzinger0_last() argument
201 return eytzinger1_last(size) - 1; in eytzinger0_last()
204 static inline unsigned eytzinger0_next(unsigned i, unsigned size) in eytzinger0_next() argument
206 return eytzinger1_next(i + 1, size) - 1; in eytzinger0_next()
209 static inline unsigned eytzinger0_prev(unsigned i, unsigned size) in eytzinger0_prev() argument
211 return eytzinger1_prev(i + 1, size) - 1; in eytzinger0_prev()
214 static inline unsigned eytzinger0_extra(unsigned size) in eytzinger0_extra() argument
216 return eytzinger1_extra(size); in eytzinger0_extra()
219 static inline unsigned __eytzinger0_to_inorder(unsigned i, unsigned size, in __eytzinger0_to_inorder() argument
222 return __eytzinger1_to_inorder(i + 1, size, extra) - 1; in __eytzinger0_to_inorder()
225 static inline unsigned __inorder_to_eytzinger0(unsigned i, unsigned size, in __inorder_to_eytzinger0() argument
228 return __inorder_to_eytzinger1(i + 1, size, extra) - 1; in __inorder_to_eytzinger0()
231 static inline unsigned eytzinger0_to_inorder(unsigned i, unsigned size) in eytzinger0_to_inorder() argument
233 return __eytzinger0_to_inorder(i, size, eytzinger0_extra(size)); in eytzinger0_to_inorder()
236 static inline unsigned inorder_to_eytzinger0(unsigned i, unsigned size) in inorder_to_eytzinger0() argument
238 return __inorder_to_eytzinger0(i, size, eytzinger0_extra(size)); in inorder_to_eytzinger0()
247 static inline int eytzinger0_find_le(void *base, size_t nr, size_t size, in eytzinger0_find_le() argument
257 n = eytzinger0_child(i, cmp(base + i * size, search) <= 0); in eytzinger0_find_le()
273 static inline int eytzinger0_find_gt(void *base, size_t nr, size_t size, in eytzinger0_find_gt() argument
276 ssize_t idx = eytzinger0_find_le(base, nr, size, cmp, search); in eytzinger0_find_gt()
289 static inline int eytzinger0_find_ge(void *base, size_t nr, size_t size, in eytzinger0_find_ge() argument
292 ssize_t idx = eytzinger0_find_le(base, nr, size, cmp, search); in eytzinger0_find_ge()
294 if (idx < nr && !cmp(base + idx * size, search)) in eytzinger0_find_ge()
300 #define eytzinger0_find(base, nr, size, _cmp, search) \ argument
305 size_t _size = (size); \