pspsdk-1.0+beta2
qsort.c File Reference
#include <stdlib.h>
Include dependency graph for qsort.c:

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

Macro Definition Documentation

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

Referenced by qsort().

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

Referenced by qsort().

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

Referenced by qsort().

#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;

Referenced by qsort().

#define thunk   NULL

Referenced by qsort().

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

Referenced by qsort().

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 
)

References a, CMP, min, r, swap, SWAPINIT, thunk, and vecswap.