satsolver  0.17.2
Macros | Typedefs | Functions
qsort_r.c File Reference
#include <sys/cdefs.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define min(a, b)   (a) < (b) ? a : b
 
#define swapcode(TYPE, parmi, parmj, n)
 
#define SWAPINIT(a, es)
 
#define swap(a, b)
 
#define vecswap(a, b, n)   if ((n) > 0) swapfunc(a, b, n, swaptype)
 
#define CMP(t, x, y)   (cmp((x), (y), (t)))
 

Typedefs

typedef int cmp_t (const void *, const void *, void *)
 

Functions

static char * med3 (char *, char *, char *, cmp_t *, void *)
 
static void swapfunc (char *, char *, int, int)
 
void sat_sort (void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
 

Macro Definition Documentation

#define min (   a,
 
)    (a) < (b) ? a : b

Definition at line 48 of file qsort_r.c.

Referenced by sat_sort().

#define swapcode (   TYPE,
  parmi,
  parmj,
 
)
Value:
{ \
long i = (n) / sizeof (TYPE); \
TYPE *pi = (TYPE *) (parmi); \
TYPE *pj = (TYPE *) (parmj); \
do { \
TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
} while (--i > 0); \
}

Definition at line 53 of file qsort_r.c.

Referenced by swapfunc().

#define SWAPINIT (   a,
  es 
)
Value:
swaptype = ((char *)a - (char *)0) % sizeof(long) || \
es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1;

Definition at line 64 of file qsort_r.c.

Referenced by sat_sort().

#define swap (   a,
 
)
Value:
if (swaptype == 0) { \
long t = *(long *)(a); \
*(long *)(a) = *(long *)(b); \
*(long *)(b) = t; \
swapfunc(a, b, es, swaptype)

Definition at line 78 of file qsort_r.c.

Referenced by sat_sort().

#define vecswap (   a,
  b,
 
)    if ((n) > 0) swapfunc(a, b, n, swaptype)

Definition at line 86 of file qsort_r.c.

Referenced by sat_sort().

#define CMP (   t,
  x,
 
)    (cmp((x), (y), (t)))

Definition at line 88 of file qsort_r.c.

Referenced by med3(), and sat_sort().

Typedef Documentation

typedef int cmp_t(const void *, const void *, void *)

Definition at line 44 of file qsort_r.c.

Function Documentation

static char * med3 ( char *  a,
char *  b,
char *  c,
cmp_t cmp,
void *  thunk 
)
inlinestatic

Definition at line 91 of file qsort_r.c.

References CMP.

Referenced by sat_sort().

static void swapfunc ( char *  a,
char *  b,
int  n,
int  swaptype 
)
inlinestatic

Definition at line 68 of file qsort_r.c.

References swapcode.

void sat_sort ( void *  a,
size_t  n,
size_t  es,
cmp_t cmp,
void *  thunk 
)