#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;
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;
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;
// 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);
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
};
// 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;
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