OpenCores
URL https://opencores.org/ocsvn/plasma/plasma/trunk

Subversion Repositories plasma

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 248 to Rev 249
    Reverse comparison

Rev 248 → Rev 249

/trunk/kernel/libc.c
112,10 → 112,19
 
void *memcpy(void *dst, const void *src, unsigned long bytes)
{
uint8 *Dst = (uint8*)dst;
uint8 *Src = (uint8*)src;
while((int)bytes-- > 0)
*Dst++ = *Src++;
if(((uint32)dst | (uint32)src | bytes) & 3)
{
uint8 *Dst = (uint8*)dst, *Src = (uint8*)src;
while((int)bytes-- > 0)
*Dst++ = *Src++;
}
else
{
uint32 *Dst32 = (uint32*)dst, *Src32 = (uint32*)src;
bytes >>= 2;
while((int)bytes-- > 0)
*Dst32++ = *Src32++;
}
return dst;
}
 
452,14 → 461,19
 
 
#ifdef INCLUDE_QSORT
#define QSORT_SIZE 256
/*********************** qsort ***********************/
static void QsortSwap(char *base, long left, long right, long size)
{
char buffer[QSORT_SIZE];
memcpy(buffer, &base[left*size], size);
memcpy(&base[left*size], &base[right*size], size);
memcpy(&base[right*size], buffer, size);
int temp, i;
char *ptrLeft, *ptrRight;
ptrLeft = base + left * size;
ptrRight = base + right * size;
for(i = 0; i < size; ++i)
{
temp = ptrLeft[i];
ptrLeft[i] = ptrRight[i];
ptrRight[i] = (char)temp;
}
}
 
 
490,11 → 504,6
long size,
int (*cmp)(const void *,const void *))
{
if(size > QSORT_SIZE)
{
printf("qsort_error");
return;
}
qsort2(base, 0, n-1, size, cmp);
}
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.