Skip to content

Instantly share code, notes, and snippets.

@radiosilence
Created November 8, 2011 23:27
Show Gist options
  • Save radiosilence/1349683 to your computer and use it in GitHub Desktop.
Save radiosilence/1349683 to your computer and use it in GitHub Desktop.
Fixed(?) unix v6 memmove
void*
memmove(void *vdst, void *vsrc, int n)
{
char *dst, *src;
dst = vdst;
src = vsrc;
if(*vdst > *vsrc) {
*vdst += n;
*vsrc += n;
while(n-- > 0)
*dst-- = *src--;
}
else if(*vdst < *vsrc)
while(n-- > 0)
*dst++ == *src++;
return vdst;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment