#ifndef _AL_ARRAY_SORT_H #define _AL_ARRAY_SORT_H #define AL_INSERSION_SORT(data, type, count, cmp) \ do { \ s32 i = 1; \ while (i < (s32)count) { \ s32 j = i - 1; \ type x = data[i]; \ while (j >= 0 && cmp(&data[j], &x) > 0) { \ data[j + 1] = data[j]; \ j--; \ } \ data[j + 1] = x; \ i++; \ } \ } while (0); #endif // _AL_ARRAY_SORT_H