feat: taken qsort from PDCLIB, Sorting drivers. Generic driver

structure. Driver ranking
This commit is contained in:
2021-03-07 14:43:35 +01:00
parent 01efc5e98a
commit f6e720bad9
11 changed files with 255 additions and 44 deletions

View File

@@ -30,8 +30,8 @@ int abs(int val) {
}
// next stolen form https://www.techiedelight.com/implement-itoa-function-in-c/
// inline function to swap two numbers
void swap(char *x, char *y) {
// inline function to swapc two numbers
void swapc(char *x, char *y) {
char t = *x;
*x = *y;
*y = t;
@@ -40,7 +40,7 @@ void swap(char *x, char *y) {
// function to reverse buffer[i..j]
char *reverse(char *buffer, int i, int j) {
while (i < j)
swap(&buffer[i++], &buffer[j--]);
swapc(&buffer[i++], &buffer[j--]);
return buffer;
}