]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/sorter/common.h
Renamed uns -> uint
[libucw.git] / ucw / sorter / common.h
index a91050b3c646dd016b5e6af1a987300cf6e51fa4..423befc59fc096e3d1c580389f96f5108b1ca18a 100644 (file)
 #ifndef _UCW_SORTER_COMMON_H
 #define _UCW_SORTER_COMMON_H
 
-#include "ucw/clists.h"
+#include <ucw/clists.h>
+
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define asort_run ucw_asort_run
+#define asort_start_threads ucw_asort_start_threads
+#define asort_stop_threads ucw_asort_stop_threads
+#define sbuck_drop ucw_sbuck_drop
+#define sbuck_has_file ucw_sbuck_has_file
+#define sbuck_have ucw_sbuck_have
+#define sbuck_new ucw_sbuck_new
+#define sbuck_read ucw_sbuck_read
+#define sbuck_size ucw_sbuck_size
+#define sbuck_swap_out ucw_sbuck_swap_out
+#define sbuck_write ucw_sbuck_write
+#define sorter_add_radix_bits ucw_sorter_add_radix_bits
+#define sorter_alloc ucw_sorter_alloc
+#define sorter_alloc_buf ucw_sorter_alloc_buf
+#define sorter_bufsize ucw_sorter_bufsize
+#define sorter_debug ucw_sorter_debug
+#define sorter_fb_params ucw_sorter_fb_params
+#define sorter_free_buf ucw_sorter_free_buf
+#define sorter_max_multiway_bits ucw_sorter_max_multiway_bits
+#define sorter_max_radix_bits ucw_sorter_max_radix_bits
+#define sorter_min_multiway_bits ucw_sorter_min_multiway_bits
+#define sorter_min_radix_bits ucw_sorter_min_radix_bits
+#define sorter_prepare_buf ucw_sorter_prepare_buf
+#define sorter_radix_threshold ucw_sorter_radix_threshold
+#define sorter_run ucw_sorter_run
+#define sorter_small_fb_params ucw_sorter_small_fb_params
+#define sorter_small_input ucw_sorter_small_input
+#define sorter_stream_bufsize ucw_sorter_stream_bufsize
+#define sorter_thread_chunk ucw_sorter_thread_chunk
+#define sorter_thread_threshold ucw_sorter_thread_threshold
+#define sorter_threads ucw_sorter_threads
+#define sorter_trace ucw_sorter_trace
+#define sorter_trace_array ucw_sorter_trace_array
+#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;
@@ -39,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;
 
@@ -65,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;
@@ -73,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);
@@ -91,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
 };
 
@@ -125,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;
@@ -140,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