Initial commit

This commit is contained in:
Gwen Gourevich
2021-10-27 10:34:18 +02:00
parent 43ad18eb04
commit c5f4f6ba25
199 changed files with 73169 additions and 0 deletions

29
SOURCES/BUBSORT.C Normal file
View File

@@ -0,0 +1,29 @@
void BubbleSort( UBYTE *base,
size_t nelem,
size_t width,
int (*fcmp)(const void *, const void *))
{
int i, j;
register UBYTE *o1, *o2, *s;
UBYTE *temp=&base[width*nelem];
o1 = base ;
for(i=1; i<nelem; i++)
{
o2 = o1+width ;
s = o1 ;
for(j=i; j<nelem; j++)
{
if ((*fcmp)(s, o2)>0)
s = o2 ;
o2 += width;
}
if (s!=o1)
{
memcpy(temp, o1, width);
memcpy(o1, s, width);
memcpy(s, temp, width);
}
o1 += width;
}
}