Go to the source code of this file.
Defines | |
#define | countof(a) (sizeof (a)/sizeof (*a)) |
Determine number of members within an array. | |
#define | indexof(a, p) ((p)-(a)) |
Determine index of pointer 'p' in array 'a'. | |
#define | inbounds(a, i) ( (size_t)(i) < countof(a) ) |
See if index 'i' is in bounds for fully typed simple array 'a'. | |
#define | memberof(a, p) ( inbounds((a),indexof((a),(p))) && ((void*)((a)+indexof((a),(p))) == (void*)(p)) ) |
See if 'p' is a valid pointer to a member of 'a'. | |
#define | array_bsort(atype, array, count, compare) |
Bubble sort an array Wins over qsort for small, or nearly sorted arrays Usually wins over qsort in 2D animation. | |
#define | array_qsort(atype, array, count, compare) qsort((array),(count),sizeof(atype),(int (*)(const void *, const void *))(compare)) |
Quicker sort an array Wins over bsort for most unsorted cases Usually wins over qsort in 2D animation. | |
#define | array_lsearch(atype, array, count, compare, key) lsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Linear search a sorted array for a particular key. | |
#define | array_bsearch(atype, array, count, compare, key) bsearch( (key), (array), (count), sizeof(atype), (compare) ) |
Binary search a sorted array for a particular key. | |
#define | array_fill(type, dst, count, value) |
Fill memory with a value, by type. |
Definition in file array.h.