X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fsorter%2Fs-internal.h;h=85557f126544aa93d49f3ddce1ce6acd82aac343;hb=15a2b6d5ef43218fc66b95e4c24b152934feb77e;hp=e921921e95241901544d48e88de817ae2befa55b;hpb=87b27e3e532a51e97407cd6f54533138d78ebd01;p=libucw.git diff --git a/lib/sorter/s-internal.h b/lib/sorter/s-internal.h index e921921e..85557f12 100644 --- a/lib/sorter/s-internal.h +++ b/lib/sorter/s-internal.h @@ -16,10 +16,9 @@ typedef struct { #define ASORT_PREFIX(x) SORT_PREFIX(array_##x) #define ASORT_KEY_TYPE P(internal_item_t) -#define ASORT_ELT(i) ary[i] #define ASORT_LT(x,y) (P(compare)((x).key, (y).key) < 0) -#define ASORT_EXTRA_ARGS , P(internal_item_t) *ary -#include "lib/arraysort.h" +#define ASORT_PAGE_ALIGNED +#include "lib/sorter/array.h" /* * The big_buf has the following layout: @@ -66,8 +65,8 @@ static inline size_t P(internal_workspace)(P(key) *key UNUSED) #ifdef SORT_UNIFY_WORKSPACE ws += SORT_UNIFY_WORKSPACE(*key); #endif -#if 0 /* FIXME: Shadow copy if radix-sorting */ - ws = MAX(ws, sizeof(P(key) *)); +#ifdef SORT_INTERNAL_RADIX + ws = MAX(ws, sizeof(P(internal_item_t))); #endif return ws; } @@ -146,7 +145,13 @@ static int P(internal)(struct sort_context *ctx, struct sort_bucket *bin, struct stk_fsize((byte*)ctx->big_buf + bufsize - end)); timestamp_t timer; init_timer(&timer); - P(array_sort)(count, item_array); + item_array = P(array_sort)(item_array, count, +#ifdef SORT_INTERNAL_RADIX + workspace, bin->hash_bits +#else + NULL, 0 +#endif + ); ctx->total_int_time += get_timer(&timer); SORT_XTRACE(4, "s-internal: Writing");