Newer
Older
ubixos / src / lib / libc / string / memcpy.c
@apwillia apwillia on 8 Jul 2002 372 bytes Improved speed (slightly)
#include <sys/types.h>
#include <string.h>

void * memcpy(void * dst, const void * src, size_t length)
{
    size_t x = length >> 2;
    size_t y = length & 0xf;
    size_t i;

    for (i = 0; i < x; i++)
	((unsigned long *)dst)[i] = ((unsigned long *)src)[i];

    for (i = 0; i < y; i++)
	((char *) dst)[length-y+i] = ((char *) src)[length-y+i];
    
    return dst;
}