X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Fsorter%2Fcommon.h;h=70e10c08f84a620dc19a4c6d10e9fff9b226d8b8;hb=d119c8b3262d795777679f55015588771453d51f;hp=db414dd08c6c033e99124ce00b373b68997a3881;hpb=5a78c3505ae7fa76a061e26676450049ec5946d5;p=libucw.git diff --git a/lib/sorter/common.h b/lib/sorter/common.h index db414dd0..70e10c08 100644 --- a/lib/sorter/common.h +++ b/lib/sorter/common.h @@ -15,6 +15,7 @@ /* Configuration, some of the variables are used by the old sorter, too. */ extern uns sorter_trace, sorter_presort_bufsize, sorter_stream_bufsize; extern uns sorter_debug, sorter_min_radix_bits, sorter_max_radix_bits; +extern uns sorter_min_multiway_bits, sorter_max_multiway_bits; extern u64 sorter_bufsize; extern struct fb_params sorter_fb_params; @@ -26,6 +27,7 @@ enum sort_debug { SORT_DEBUG_NO_JOIN = 2, SORT_DEBUG_KEEP_BUCKETS = 4, SORT_DEBUG_NO_RADIX = 8, + SORT_DEBUG_NO_MULTIWAY = 16, }; struct sort_bucket; @@ -54,6 +56,9 @@ struct sort_context { // Bucket arrays are NULL-terminated. void (*twoway_merge)(struct sort_context *ctx, struct sort_bucket **ins, struct sort_bucket **outs); + // Multi-way merge: merge an arbitrary number of source buckets to a single destination bucket. + void (*multiway_merge)(struct sort_context *ctx, struct sort_bucket **ins, struct sort_bucket *out); + // Radix split according to hash function void (*radix_split)(struct sort_context *ctx, struct sort_bucket *in, struct sort_bucket **outs, uns bitpos, uns numbits); @@ -108,6 +113,5 @@ sh_off_t sbuck_size(struct sort_bucket *b); struct fastbuf *sbuck_read(struct sort_bucket *b); struct fastbuf *sbuck_write(struct sort_bucket *b); void sbuck_swap_out(struct sort_bucket *b); -void format_size(byte *buf, u64 x); #endif