#include <stdlib.h>
#include "epicsAssert.h"
#include "ellLib.h"
Go to the source code of this file.
Stable (MergeSort) of a given list.
- Parameters
-
pList | Pointer to list to be sorted |
pListCmp | Compare function to be used |
- Note
- The comparison function cmp(A,B) is expected to return -1 for A<B, 0 for A==B, and 1 for A>B.
-
Use of mergesort algorithm based on analysis by http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html
Definition at line 30 of file ellSort.c.
57 ellMoveN(&Q, &INP, insize);
58 ellMoveN(&P, &INP, insize);
#define assert(exp)
Declare that a condition should be true.
#define ellCount(PLIST)
Report the number of nodes in a list.
ELLNODE * ellGet(ELLLIST *pList)
Deletes and returns the first node from a list.
void ellAdd(ELLLIST *pList, ELLNODE *pNode)
Adds a node to the end of a list.
#define ellInit(PLIST)
Initialize a list type.
void ellConcat(ELLLIST *pDstList, ELLLIST *pAddList)
Concatenates a list to the end of another list. The list to be added is left empty. Either list (or both) can be empty at the beginning of the operation.
#define ellFirst(PLIST)
Find the first node in list.