Lines Matching refs:array
97 #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) argument
106 #define IS_ARRAY(array) \
108 !__builtin_types_compatible_p(__typeof__(array), \
109 __typeof__(&(array)[0])))
120 #define ARRAY_SIZE(array) \
121 ((size_t) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
162 #define IS_ARRAY_ELEMENT(array, ptr) \ argument
163 ((ptr) && POINTER_TO_UINT(array) <= POINTER_TO_UINT(ptr) && \
164 POINTER_TO_UINT(ptr) < POINTER_TO_UINT(&(array)[ARRAY_SIZE(array)]) && \
165 (POINTER_TO_UINT(ptr) - POINTER_TO_UINT(array)) % sizeof((array)[0]) == 0)
181 #define ARRAY_INDEX(array, ptr) \ argument
183 __ASSERT_NO_MSG(IS_ARRAY_ELEMENT(array, ptr)); \
184 (__typeof__((array)[0]) *)(ptr) - (array); \
197 #define PART_OF_ARRAY(array, ptr) \ argument
198 ((ptr) && POINTER_TO_UINT(array) <= POINTER_TO_UINT(ptr) && \
199 POINTER_TO_UINT(ptr) < POINTER_TO_UINT(&(array)[ARRAY_SIZE(array)]))
218 #define ARRAY_INDEX_FLOOR(array, ptr) \ argument
220 __ASSERT_NO_MSG(PART_OF_ARRAY(array, ptr)); \
221 (POINTER_TO_UINT(ptr) - POINTER_TO_UINT(array)) / sizeof((array)[0]); \
230 #define ARRAY_FOR_EACH(array, idx) for (size_t idx = 0; (idx) < ARRAY_SIZE(array); ++(idx)) argument
238 #define ARRAY_FOR_EACH_PTR(array, ptr) \ argument
239 for (__typeof__(*(array)) *ptr = (array); (size_t)((ptr) - (array)) < ARRAY_SIZE(array); \