Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/modules/klibc/memmove.c

Source at commit 1793 created 12 years 5 months ago.
By blackosx, Attempt to overcome issue 211 by revising the code to remove all package .svn files before function makeSubstitutions() is called. The line it replaces should work but I can't figure out why it doesn't...
1/*
2 * memmove.c
3 */
4
5#include "libsaio.h"
6
7void *memmove(void *dst, const void *src, size_t n)
8{
9const char *p = src;
10char *q = dst;
11#if defined(__i386__) || defined(__x86_64__)
12if (q < p) {
13asm volatile("cld; rep; movsb"
14 : "+c" (n), "+S"(p), "+D"(q));
15} else {
16p += (n - 1);
17q += (n - 1);
18asm volatile("std; rep; movsb; cld"
19 : "+c" (n), "+S"(p), "+D"(q));
20}
21#else
22if (q < p) {
23while (n--) {
24*q++ = *p++;
25}
26} else {
27p += n;
28q += n;
29while (n--) {
30*--q = *--p;
31}
32}
33#endif
34
35return dst;
36}
37

Archive Download this file

Revision: 1793