home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
mntlib32.zoo
/
lattice
/
memcpy.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-11
|
585b
|
37 lines
/* from Henry Spencer's stringlib */
#include <stddef.h>
#include <string.h>
/*
* memcpy - copy bytes
*/
void *
memcpy(dst, src, size)
void * dst;
const void * src;
size_t size;
{
register char *d;
register const char *s;
register size_t n;
if (size == 0)
return(dst);
s = (const char *) src;
d = (char *) dst;
if (s <= d && s + (size-1) >= d) {
/* Overlap, must copy right-to-left. */
s += size-1;
d += size-1;
for (n = size; n > 0; n--)
*d-- = *s--;
} else
for (n = size; n > 0; n--)
*d++ = *s++;
return(dst);
}