X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fsorter%2Fcommon.h;h=423befc59fc096e3d1c580389f96f5108b1ca18a;hb=c8ffd6e3b4fc8fd6437c04282c357b2dc290bbbd;hp=2001690973426380d5015231ba9a80406c0404f9;hpb=a4f8b029b86d2ca1612a9c2e2795ccea27b15276;p=libucw.git diff --git a/ucw/sorter/common.h b/ucw/sorter/common.h index 20016909..423befc5 100644 --- a/ucw/sorter/common.h +++ b/ucw/sorter/common.h @@ -49,10 +49,10 @@ #endif /* Configuration variables */ -extern uns sorter_trace, sorter_trace_array, sorter_stream_bufsize; -extern uns sorter_debug, sorter_min_radix_bits, sorter_max_radix_bits, sorter_add_radix_bits; -extern uns sorter_min_multiway_bits, sorter_max_multiway_bits; -extern uns sorter_threads; +extern uint sorter_trace, sorter_trace_array, sorter_stream_bufsize; +extern uint sorter_debug, sorter_min_radix_bits, sorter_max_radix_bits, sorter_add_radix_bits; +extern uint sorter_min_multiway_bits, sorter_max_multiway_bits; +extern uint sorter_threads; extern u64 sorter_bufsize, sorter_small_input; extern u64 sorter_thread_threshold, sorter_thread_chunk, sorter_radix_threshold; extern struct fb_params sorter_fb_params, sorter_small_fb_params; @@ -75,7 +75,7 @@ struct sort_bucket; struct sort_context { struct fastbuf *in_fb; struct fastbuf *out_fb; - uns hash_bits; + uint hash_bits; u64 in_size; struct fb_params *fb_params; @@ -101,7 +101,7 @@ struct sort_context { 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); + void (*radix_split)(struct sort_context *ctx, struct sort_bucket *in, struct sort_bucket **outs, uint bitpos, uint numbits); // State variables of internal_sort void *key_buf; @@ -109,15 +109,15 @@ struct sort_context { // Timing timestamp_t start_time; - uns last_pass_time; - uns total_int_time, total_pre_time, total_ext_time; + uint last_pass_time; + uint total_int_time, total_pre_time, total_ext_time; }; void sorter_run(struct sort_context *ctx); /* Buffers */ -void *sorter_alloc(struct sort_context *ctx, uns size); +void *sorter_alloc(struct sort_context *ctx, uint size); void sorter_prepare_buf(struct sort_context *ctx); void sorter_alloc_buf(struct sort_context *ctx); void sorter_free_buf(struct sort_context *ctx); @@ -127,12 +127,12 @@ void sorter_free_buf(struct sort_context *ctx); struct sort_bucket { cnode n; struct sort_context *ctx; - uns flags; + uint flags; struct fastbuf *fb; byte *filename; u64 size; // Size in bytes (not valid when writing) - uns runs; // Number of runs, 0 if not sorted - uns hash_bits; // Remaining bits of the hash function + uint runs; // Number of runs, 0 if not sorted + uint hash_bits; // Remaining bits of the hash function byte *ident; // Identifier used in debug messages }; @@ -161,14 +161,14 @@ struct asort_context { // Interface between generic code in array.c and functions generated by array.h void *array; // Array to sort void *buffer; // Auxiliary buffer (required when radix-sorting) - uns num_elts; // Number of elements in the array - uns elt_size; // Bytes per element - uns hash_bits; // Remaining bits of the hash function - uns radix_bits; // How many bits to process in a single radix-sort pass - void (*quicksort)(void *array_ptr, uns num_elts); - void (*quicksplit)(void *array_ptr, uns num_elts, int *leftp, int *rightp); - void (*radix_count)(void *src_ptr, uns num_elts, uns *cnt, uns shift); - void (*radix_split)(void *src_ptr, void *dest_ptr, uns num_elts, uns *ptrs, uns shift); + uint num_elts; // Number of elements in the array + uint elt_size; // Bytes per element + uint hash_bits; // Remaining bits of the hash function + uint radix_bits; // How many bits to process in a single radix-sort pass + void (*quicksort)(void *array_ptr, uint num_elts); + void (*quicksplit)(void *array_ptr, uint num_elts, int *leftp, int *rightp); + void (*radix_count)(void *src_ptr, uint num_elts, uint *cnt, uint shift); + void (*radix_split)(void *src_ptr, void *dest_ptr, uint num_elts, uint *ptrs, uint shift); // Used internally by array.c struct rs_work **rs_works; @@ -176,13 +176,13 @@ struct asort_context { struct eltpool *eltpool; // Configured limits translated from bytes to elements - uns thread_threshold; - uns thread_chunk; - uns radix_threshold; + uint thread_threshold; + uint thread_chunk; + uint radix_threshold; }; void asort_run(struct asort_context *ctx); -void asort_start_threads(uns run); +void asort_start_threads(uint run); void asort_stop_threads(void); #endif