X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fmemmove.c;h=ba73742ce0fda71718d004ee5d0228140b8a8be6;hb=e5456e3c2697c4e17fc9aa3439f2e305517b4d96;hp=9ecce5db20fa32741d4ab4164fa6214a38d3dde9;hpb=dcc8a8e99f69e090a03b7b868443addbc0817820;p=pdclib.old diff --git a/functions/string/memmove.c b/functions/string/memmove.c index 9ecce5d..ba73742 100644 --- a/functions/string/memmove.c +++ b/functions/string/memmove.c @@ -6,3 +6,33 @@ // ---------------------------------------------------------------------------- void * memmove( void * s1, const void * s2, size_t n ) { /* TODO */ }; + +/* PDPC code - unreviewed +{ + char *p = s1; + const char *cs2 = s2; + size_t x; + + if (p <= cs2) + { + for (x=0; x < n; x++) + { + *p = *cs2; + p++; + cs2++; + } + } + else + { + if (n != 0) + { + for (x=n-1; x > 0; x--) + { + *(p+x) = *(cs2+x); + } + } + *(p+x) = *(cs2+x); + } + return (s1); +} +*/ \ No newline at end of file