LTCD_070816.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:20 +02:00
1 parent d14bbc24f9
commit 0e9364ff4c
506 files changed
+157705 -41812

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
void QSort(void *base,U8 num, U8 width, I8 my_compare(void *e1,void *e2))
{ //This uses a shell sort
I8 span=num>>1,i;
U1 *b1,*b2,*temp=MAlloc(width);
BoolU4 cont;
while (span) {
cont=TRUE;
while (cont) {
cont=FALSE;
for (i=0;i+span<num;i++) {
b1=base+width*i;
b2=base+width*(i+span);
if (my_compare(b1,b2)>0) {
MemCpy(temp,b1,width);
MemCpy(b1,b2,width);
MemCpy(b2,temp,width);
cont=TRUE;
}
}
}
span>>=1;
}
Free(temp);
}