VOID EngSort(
PBYTE pjBuf, | |
ULONG c, | |
ULONG cjElem, | |
SORTCOMP pfnComp | |
); |
EngSort performs a quick-sort on the specified list.
EngSort implements a quick-sort algorithm to sort cjElem elements in pjBuf, where each element is of size c. The sorted elements are returned in pjBuf; that is, the original contents of the buffer are overwritten with the sorted results.
The basis for comparing two elements is defined in the function that pfnComp points to. This function is defined as follows:
INT Compare((VOID *)element1, (VOID *)element2);
where element1 and element2 are the two elements to be compared, and the return value is the result of the comparison defined as follows:
Return Value |
Meaning |
Negative integer |
element1 < element2 |
Zero |
element1 = element2 |
Positive integer |
element1 > element2 |
The array is sorted in increasing order, which is defined by the pfnComp parameter.