Lines 34-39
Link Here
|
34 |
__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); |
34 |
__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); |
35 |
|
35 |
|
36 |
#include <stdlib.h> |
36 |
#include <stdlib.h> |
|
|
37 |
#include <limits.h> |
37 |
|
38 |
|
38 |
#ifdef I_AM_QSORT_R |
39 |
#ifdef I_AM_QSORT_R |
39 |
typedef int cmp_t(void *, const void *, const void *); |
40 |
typedef int cmp_t(void *, const void *, const void *); |
Lines 59-66
Link Here
|
59 |
} while (--i > 0); \ |
60 |
} while (--i > 0); \ |
60 |
} |
61 |
} |
61 |
|
62 |
|
62 |
#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ |
63 |
#if LONG_BIT > WORD_BIT |
|
|
64 |
#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ |
65 |
es % sizeof(long) ? ((char *)a - (char *)0) % sizeof(int) || es % \ |
66 |
sizeof(int) ? 3 : 2 : es == sizeof(long)? 0 : 1; |
67 |
#else |
68 |
#define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ |
63 |
es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; |
69 |
es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; |
|
|
70 |
#endif |
71 |
|
64 |
|
72 |
|
65 |
static inline void |
73 |
static inline void |
66 |
swapfunc(a, b, n, swaptype) |
74 |
swapfunc(a, b, n, swaptype) |
Lines 69-74
Link Here
|
69 |
{ |
77 |
{ |
70 |
if(swaptype <= 1) |
78 |
if(swaptype <= 1) |
71 |
swapcode(long, a, b, n) |
79 |
swapcode(long, a, b, n) |
|
|
80 |
#if LONG_BIT > WORD_BIT |
81 |
else if(swaptype <= 2) |
82 |
swapcode(int, a, b, n) |
83 |
#endif |
72 |
else |
84 |
else |
73 |
swapcode(char, a, b, n) |
85 |
swapcode(char, a, b, n) |
74 |
} |
86 |
} |