X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fmemmove.c;h=ba73742ce0fda71718d004ee5d0228140b8a8be6;hp=9ecce5db20fa32741d4ab4164fa6214a38d3dde9;hb=0a5395faab237ba9008352b0f4bee9659bbd3d5f;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec 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