#include "system.h"
Go to the source code of this file.
Defines | |
#define | NATURAL |
#define | THRESHOLD 16 |
#define | ISIZE sizeof(int) |
#define | PSIZE sizeof(unsigned char *) |
#define | ICOPY_LIST(src, dst, last) |
#define | ICOPY_ELT(src, dst, i) |
#define | CCOPY_LIST(src, dst, last) |
#define | CCOPY_ELT(src, dst, i) |
#define | EVAL(p) |
#define | swap(a, b) |
#define | reverse(bot, top) |
Functions | |
static void | insertionsort (unsigned char *a, size_t n, size_t size, int(*cmp)(const void *, const void *)) |
static void | setup (unsigned char *list1, unsigned char *list2, size_t n, size_t size, int(*cmp)(const void *, const void *)) |
int | mergesort (void *base, size_t nmemb, size_t size, int(*cmp)(const void *, const void *)) |
Mergesort, same arguments as qsort(2). |
#define CCOPY_ELT | ( | src, | |||
dst, | |||||
i | ) |
Value:
do \ *dst++ = *src++; \ while (i -= 1)
Definition at line 74 of file merge.c.
Referenced by mergesort().
#define CCOPY_LIST | ( | src, | |||
dst, | |||||
last | ) |
Value:
do \ *dst++ = *src++; \ while (src < last)
Definition at line 70 of file merge.c.
Referenced by mergesort().
#define EVAL | ( | p | ) |
#define ICOPY_ELT | ( | src, | |||
dst, | |||||
i | ) |
#define ICOPY_LIST | ( | src, | |||
dst, | |||||
last | ) |
#define ISIZE sizeof(int) |
#define PSIZE sizeof(unsigned char *) |
#define reverse | ( | bot, | |||
top | ) |
#define swap | ( | a, | |||
b | ) |
Value:
{ \ s = b; \ i = size; \ do { \ tmp = *a; *a++ = *s; *s++ = tmp; \ } while (--i); \ a -= size; \ }
Definition at line 89 of file merge.c.
Referenced by insertionsort(), and setup().
static void insertionsort | ( | unsigned char * | a, | |
size_t | n, | |||
size_t | size, | |||
int(*)(const void *, const void *) | cmp | |||
) | [static] |
int mergesort | ( | void * | base, | |
size_t | nmemb, | |||
size_t | size, | |||
int(*)(const void *, const void *) | cmp | |||
) |
Mergesort, same arguments as qsort(2).
Definition at line 208 of file merge.c.
References CCOPY_ELT, CCOPY_LIST, errno, EVAL, ICOPY_ELT, ICOPY_LIST, ISIZE, PSIZE, and setup().
Referenced by rpmdbSortIterator().
static void setup | ( | unsigned char * | list1, | |
unsigned char * | list2, | |||
size_t | n, | |||
size_t | size, | |||
int(*)(const void *, const void *) | cmp | |||
) | [static] |
Definition at line 136 of file merge.c.
References EVAL, insertionsort(), reverse, swap, and THRESHOLD.
Referenced by mergesort().