Sorting/ValueBased/Linux-2.6.6-rc2-fs-xfs-support-qsort.c File Reference

#include <linux/types.h>
#include <linux/kernel.h>

Defines

#define min(x, y)   (x) < (y) ? (x):(y)
#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)

Functions

static __inline void swapfunc (char *a, char *b, int n, int swaptype)
static __inline char * med3 (char *a, char *b, char *c, int(*cmp)(const void *, const void *))
void sortValues (void *aa, size_t n, size_t es, int(*cmp)(const void *, const void *))

Define Documentation

#define min ( x,
 )     (x) < (y) ? (x):(y)

#define swap ( a,
b   ) 

Value:

if (swaptype == 0) { \
 long t = *(long *)(a); \
 *(long *)(a) = *(long *)(b); \
 *(long *)(b) = t; \
 } else \
 swapfunc(a, b, es, swaptype)

#define swapcode ( TYPE,
parmi,
parmj,
n   ) 

Value:

{ \
 long i = (n) / sizeof (TYPE); \
 register TYPE *pi = (TYPE *) (parmi); \
 register TYPE *pj = (TYPE *) (parmj); \
 do { \
 register TYPE t = *pi; \
 *pi++ = *pj; \
 *pj++ = t; \
 } while (--i > 0); \
}

#define SWAPINIT ( a,
es   ) 

Value:

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

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


Function Documentation

static __inline char* med3 ( char *  a,
char *  b,
char *  c,
int(*)(const void *, const void *)  cmp 
) [static]

void sortValues ( void *  aa,
size_t  n,
size_t  es,
int(*)(const void *, const void *)  cmp 
)

static __inline void swapfunc ( char *  a,
char *  b,
int  n,
int  swaptype 
) [static]

Algorithm Development Kit 1.0