File: memmove.c

package info (click to toggle)
hx 0.7.10-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 564 kB
  • ctags: 834
  • sloc: ansic: 7,900; sh: 152; makefile: 84
file content (16 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* memmove -- copy memory to memory until the specified number of bytes
 * has been copied.  Overlap is handled correctly.
 */
#include "hx_types.h"

void *
memmove (void *dst, const void *src, size_t len)
{
	register unsigned char *sp = (unsigned char *)src + len, *start = (unsigned char *)src;
	register unsigned char *dp = (unsigned char *)dst + len;

	while (sp >= start)
		*dp-- = *sp--;

	return dst;
}