qsort.c File Reference

#include <stdlib.h>

Defines

#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)))
#define thunk   NULL

Typedefs

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

Functions

void qsort (void *a, size_t n, size_t es, cmp_t *cmp)


Define Documentation

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

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

#define swap ( a,
 ) 

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,
 ) 

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 thunk   NULL

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


Typedef Documentation

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


Function Documentation

void qsort ( void *  a,
size_t  n,
size_t  es,
cmp_t cmp 
)


Generated on Tue Jul 24 15:21:24 2007 for PSPSDK-Rev2272 by  doxygen 1.5.2