qsort.c File Reference

#include "libc.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), (size_t)(n), swaptype)

Functions

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

Define Documentation

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

#define swap a,
 ) 
 

Value:

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

#define swapcode TYPE,
parmi,
parmj,
 ) 
 

Value:

{               \
        size_t i = (n) / sizeof (TYPE);                 \
        TYPE *pi = (TYPE *)(void *)(parmi);             \
        TYPE *pj = (TYPE *)(void *)(parmj);             \
        do {                                            \
                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,
 )     if ((n) > 0) swapfunc((a), (b), (size_t)(n), swaptype)
 


Function Documentation

static __inline char* med3 char *  a,
char *  b,
char *  c,
int *  cmp
[static]
 

static __inline char* med3 char *  ,
char *  ,
char *  ,
int(*)(const void *, const void *) 
[static]
 

void qsort void *  a,
size_t  n,
size_t  es,
int *  cmp
 

static __inline void swapfunc char *  ,
char *  ,
size_t  ,
int 
[static]
 


Generated on Wed May 24 23:05:54 2006 for LSE/OS by  doxygen 1.4.6