#include <stdlib.h>
#include <search.h>
Go to the source code of this file.
|
#define | long intptr_t |
|
#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(x, y) (cmp((x), (y))) |
|
|
static __inline void | swapfunc (char *a, char *b, intptr_t n, int swaptype) |
|
static __inline char * | med3 (char *a, char *b, char *c, int(__cdecl *cmp)(const void *, const void *)) |
|
void __cdecl | qsort (void *a, size_t n, size_t es, int(__cdecl *cmp)(const void *, const void *)) |
|
◆ CMP
◆ long
Definition at line 33 of file qsort.c.
Referenced by __do_global_ctors(), __debug_alloc< _Alloc >::__extra_after_chunk(), __debug_alloc< _Alloc >::__extra_before_chunk(), __remainder_piby2(), __remainder_piby2f(), __write_formatted_timeT(), _bdf_list_ensure(), _bdf_parse_glyphs(), _bdf_readstream(), _lrotl(), _lrotr(), _mm_movpi64_epi64(), _svcauth_des(), _svcauth_unix(), _tzset(), access_virt_barray(), access_virt_sarray(), CInternetToolbar::AddString(), adler32_combine_(), TrimRegion::advance(), APICCalibrateTimer(), BDF_Face_Init(), bit_read_long(), bmap(), CC_MouseCheckColorGraph(), CC_PaintCross(), CC_PaintTriangle(), check_file(), chm_openW(), convert_1970_to_filetime(), convert_utf16bom(), __debug_alloc< _Alloc >::deallocate(), decode_header(), DefineDosDeviceW(), deflateSetDictionary(), DGifDecompressInput(), DGifGetImageDesc(), do_barray_io(), do_div(), do_sarray_io(), doflag(), DrawStarField(), empty(), EndLog(), ext4_ext_rm_leaf(), fill_window(), fillbytes(), floor(), FT_FixedFromFIXED(), FT_Stream_Open(), generic_head_read(), TrimRegion::getGridExtent(), GetHostByName(), CInternetToolbar::GetState(), gettimeofday(), handle_apetag(), inflate_fast(), inflateMark(), Varray::init(), Uarray::init(), init_waitqueue_entry(), init_waitqueue_head(), initial_setup(), jinit_c_coef_controller(), jinit_c_main_controller(), jinit_compress_master(), jinit_d_coef_controller(), jinit_d_post_controller(), jinit_upsampler(), journal_bmap(), jpeg_add_quant_table(), jpeg_calc_output_dimensions(), jpeg_finish_compress(), jpeg_read_raw_data(), jpeg_read_scanlines(), jpeg_write_raw_data(), jpeg_write_scanlines(), main(), master_selection(), MCIQTZ_mciSetAudio(), movebytes(), mpg123_getpar(), mpg123_getstate(), output_pass_setup(), parse_arguments(), parse_new_id3(), per_scan_setup(), PrPhilBar(), CConsole::ReadLine(), ReadUnalignedU32(), ReadUnalignedU64(), realize_virt_arrays(), remainder(), rsa_exptmod(), Subdivider::samplingSplit(), SelectSetInit(), set_pointer(), Arc::setside(), START_TEST(), strtol(), strtoull(), synth_ntom_set_step(), test_assign(), transdecode_master_selection(), TRIO_ARGS2(), UDFInitializeFunctionPointers(), ui_create_colourmap(), vio_modern_query_vq_alloc(), WaitResponse(), wave_out_set_format(), wcstol(), wcstoul(), win32_tell_file_func(), xdr_int(), xdr_int16_t(), xdr_int32_t(), xdr_putint32(), xdr_short(), xdrrec_getlong(), xdrstdio_getlong(), xdrstdio_putlong(), xmlDictComputeFastQKey(), xmlHashComputeQKey(), xmlMemDisplayLast(), xsltGenerateIdFunction(), and zerobytes().
◆ min
◆ swap
Value: if (swaptype == 0) { \
*(
long *)(
a) = *(
long *)(
b); \
} else \
swapfunc(
a,
b,
es, swaptype)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
Definition at line 63 of file qsort.c.
◆ swapcode
Value: { \
long i = (
n) /
sizeof (
TYPE); \
do { \
}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition at line 40 of file qsort.c.
◆ SWAPINIT
Value: swaptype = ((
char *)
a - (
char *)0) %
sizeof(
long) || \
es %
sizeof(
long) ? 2 :
es ==
sizeof(
long)? 0 : 1;
Definition at line 51 of file qsort.c.
◆ vecswap
◆ med3()
◆ qsort()
Definition at line 93 of file qsort.c.
94{
95 char *
pa, *pb, *pc, *pd, *pl, *
pm, *
pn;
96 int swaptype, swap_cnt;
98
100 swap_cnt = 0;
103 for (pl =
pm; pl > (
char *)
a &&
CMP(pl -
es, pl) > 0;
106 return;
107 }
108 pm = (
char *)
a + (
n / 2) *
es;
111 pn = (
char *)
a + (
n - 1) *
es;
117 }
119 }
121 pa = pb = (
char *)
a +
es;
122
123 pc = pd = (
char *)
a + (
n - 1) *
es;
124 for (;;) {
125 while (pb <= pc && (
r =
CMP(pb,
a)) <= 0) {
127 swap_cnt = 1;
130 }
132 }
133 while (pb <= pc && (
r =
CMP(pc,
a)) >= 0) {
135 swap_cnt = 1;
138 }
140 }
141 if (pb > pc)
142 break;
144 swap_cnt = 1;
147 }
148 if (swap_cnt == 0) {
150 for (pl =
pm; pl > (
char *)
a &&
CMP(pl -
es, pl) > 0;
153 return;
154 }
155
161 if ((
r = pb -
pa) >
es)
163 if ((
r = pd - pc) >
es) {
164
167 goto loop;
168 }
169}
GLdouble GLdouble GLdouble r
#define cmp(status, error)
void __cdecl qsort(void *a, size_t n, size_t es, int(__cdecl *cmp)(const void *, const void *))
static __inline char * med3(char *a, char *b, char *c, int(__cdecl *cmp)(const void *, const void *))
Referenced by qsort().
◆ swapfunc()
Definition at line 55 of file qsort.c.
56{
57 if(swaptype <= 1)
59 else
61}
#define swapcode(TYPE, parmi, parmj, n)