gwenhywfar  5.14.1
quicksort.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Dec 30 2025
3  copyright : (C) 2025 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 #ifdef HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28 
29 #include "./quicksort.h"
30 #include "./sort_r.h"
31 
32 
33 #define DISABLE_DEBUGLOG
34 
35 
36 /* ------------------------------------------------------------------------------------------------
37  * forward declarations
38  * ------------------------------------------------------------------------------------------------
39  */
40 
41 
42 
43 
44 /* ------------------------------------------------------------------------------------------------
45  * implementations
46  * ------------------------------------------------------------------------------------------------
47  */
48 
49 void GWEN_QuickSort(void *array, int numElems, int sizeElems, GWEN_QUICKSORT_COMPARE_CB cb, void *arg)
50 {
51  sort_r(array, numElems, sizeElems, cb, arg);
52 }
53 
54 
55 
56 
57 
58 
59 
60 /* include tests */
61 #include "quicksort-t.c"
62 
63 
int(* GWEN_QUICKSORT_COMPARE_CB)(const void *p1, const void *p2, void *arg)
Definition: quicksort.h:35
void GWEN_QuickSort(void *array, int numElems, int sizeElems, GWEN_QUICKSORT_COMPARE_CB cb, void *arg)
Definition: quicksort.c:49
static _SORT_R_INLINE void sort_r(void *base, size_t nel, size_t width, int(*compar)(const void *_a, const void *_b, void *_arg), void *arg)
Definition: sort_r.h:274