#undef DUPLICATE
#define DUPLICATE
/***
 ***/

/*****	Constant definitions */
#ifndef TRUE
#define TRUE            1
#endif

#ifndef FALSE
#define	FALSE		0
#endif

/***** Error return codes */
#define	OUT_OF_BOUND_BSP	100
#define MALLOC_BSP		101

/*****	Typedefs */


/*****	Function Definitions */

#define	MIN(x,y)	((x)<=(y)?(x):(y)) 
#define	MAX(x,y)	((x)>=(y)?(x):(y))
#define CEIL(X,Y)       ((X != 0)?(1+ (X-1)/Y):0)  
#define OLD_CEIL(X,Y)   ((((X/Y)*Y)==X)?(X/Y):(X/Y+1))  
#define FLOOR(X,Y)      (X/Y)  
#define LEFT(x,y)       (x-(x/y)*y)

void check_if_null(void *x,char *s,char *t);
void operator_add(int *result,int *left,int *right,int size);

/* seqsort.c */

int FLog2 (int x);
int CLog2 (int x);
int Exp2 (int x);
void sort_ins (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void sort_q (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void str_select (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void sort2_q (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void qsort2 (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void heap2 (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void gnu_qsort (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void sort_h (char *src,int n,int sbytes,int (*compare)(const void*,const void*) );
void sortint_ins (int *src,int n);
void sortint_q (int *src,int n,int sbytes,int (*compare)(const void*,const void*));
void quicki(int *src,int n,int sbytes,int (*compare)(const void*,const void*));
void quick(char *src,int n,int sbytes,int (*compare)(const void*,const void*));
void sortint_h (int *src,int n,int sbytes,int (*compare)(const void*,const void*));
void heapi (int *src,int n,int sbytes,int (*compare)(const void*,const void*));
void sort_mrg (char *src,int n,int sbytes,int (*compare)(const void*,const void*));
void heap (char *src,int n,int sbytes,int (*compare)(const void*,const void*));
void Merge (char *src,int n,int sbytes,int (*compare)(const void*,const void*));
void sortint_mrg (int  *src,int  n,int sbytes,int (*compare)(const void*,const void*));
void mergei (int  *src,int  n,int sbytes,int (*compare)(const void*,const void*));

void sortint_cntparameters(int n,unsigned int mx_int,int *sbits,int *nbits);
void sortint_cnt (unsigned int *src,int n,unsigned int mx_int);
void sortint_cntmx(unsigned int *src,int n);


/* Sorting related */
int compare(const void  *left,const void *right);

int Bin_Search (char *key, char *base, int n_elem, int size_elem, int (*compare) ());
void Sort_Rnd ();

