This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Call memcpy in generic mempcpy
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Wed, 6 Feb 2013 21:53:34 +0100
- Subject: [PATCH] Call memcpy in generic mempcpy
As most ports have optimized memcpy implementatin but I
did not find mempcpy implementation a best way to handle it genericaly is
simply call memcpy.
OK to commit?
2013-02-06 OndÅej BÃlka <neleai@seznam.cz>
* string/mempcpy.c: Implement by calling memcpy.
diff --git a/string/mempcpy.c b/string/mempcpy.c
index ba4d1c6..1d4c43f 100644
--- a/string/mempcpy.c
+++ b/string/mempcpy.c
@@ -20,8 +20,6 @@
<http://www.gnu.org/licenses/>. */
#include <string.h>
-#include <memcopy.h>
-#include <pagecopy.h>
#undef mempcpy
#undef __mempcpy
@@ -33,35 +31,8 @@ __mempcpy (dstpp, srcpp, len)
size_t len;
{
unsigned long int dstp = (long int) dstpp;
- unsigned long int srcp = (long int) srcpp;
-
- /* Copy from the beginning to the end. */
-
- /* If there not too few bytes to copy, use word copy. */
- if (len >= OP_T_THRES)
- {
- /* Copy just a few bytes to make DSTP aligned. */
- len -= (-dstp) % OPSIZ;
- BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
-
- /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
- as much as possible. */
-
- PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
-
- /* Copy from SRCP to DSTP taking advantage of the known alignment of
- DSTP. Number of bytes remaining is put in the third argument,
- i.e. in LEN. This number may vary from machine to machine. */
-
- WORD_COPY_FWD (dstp, srcp, len, len);
-
- /* Fall out and copy the tail. */
- }
-
- /* There are just a few bytes to copy. Use byte memory operations. */
- BYTE_COPY_FWD (dstp, srcp, len);
-
- return (void *) dstp;
+ memcpy (dstpp, srcpp, len);
+ return (void *) (dstp + len);
}
libc_hidden_def (__mempcpy)
weak_alias (__mempcpy, mempcpy)