feat: taken qsort from PDCLIB, Sorting drivers. Generic driver
structure. Driver ranking
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user