X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fsorter%2Farray-simple.h;h=5e442439f78e8df98ef40eb7cb2fbfbfa4bbaf3a;hb=342e0c3edeacf4eecd03da36c879ca817c64a0f3;hp=393ebd9315219c78c31e01632fb2e3d34676bce6;hpb=75aef35d7e88770e461f8f683f970192012583e3;p=libucw.git diff --git a/ucw/sorter/array-simple.h b/ucw/sorter/array-simple.h index 393ebd93..5e442439 100644 --- a/ucw/sorter/array-simple.h +++ b/ucw/sorter/array-simple.h @@ -57,15 +57,19 @@ #endif #ifndef ASORT_ELT -#define ASORT_ARRAY_ARG +#define ASORT_ARRAY_ARG ASORT_KEY_TYPE *array, #define ASORT_ELT(i) array[i] +#else +#define ASORT_ARRAY_ARG #endif -static void ASORT_PREFIX(sort)( -#ifdef ASORT_ARRAY_ARG - ASORT_KEY_TYPE *array, -#endif - uns array_size ASORT_EXTRA_ARGS) +/** + * The generated sorting function. If `ASORT_ELT` macro is not provided, the + * @ASORT_ARRAY_ARG is equal to `ASORT_KEY_TYPE *array` and is the array to be + * sorted. If the macro is provided, this parameter is omitted. In that case, + * you can sort global variables or pass your structure by @ASORT_EXTRA_ARGS. + **/ +static void ASORT_PREFIX(sort)(ASORT_ARRAY_ARG uns array_size ASORT_EXTRA_ARGS) { struct stk { int l, r; } stack[8*sizeof(uns)]; int l, r, left, right, m;