mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-17 13:00:43 +08:00
Call memcpy in generic mempcpy
This commit is contained in:
parent
c2af38aa76
commit
170704c9ec
@ -1,3 +1,7 @@
|
|||||||
|
2013-02-13 Ondřej Bílka <neleai@seznam.cz>
|
||||||
|
|
||||||
|
* string/mempcpy.c: Implement by calling memcpy.
|
||||||
|
|
||||||
2013-02-13 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2013-02-13 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove NFA.
|
* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Remove NFA.
|
||||||
|
@ -20,48 +20,14 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <memcopy.h>
|
|
||||||
#include <pagecopy.h>
|
|
||||||
|
|
||||||
#undef mempcpy
|
#undef mempcpy
|
||||||
#undef __mempcpy
|
#undef __mempcpy
|
||||||
|
|
||||||
void *
|
void *
|
||||||
__mempcpy (dstpp, srcpp, len)
|
__mempcpy (void *dest, const void *src, size_t len)
|
||||||
void *dstpp;
|
|
||||||
const void *srcpp;
|
|
||||||
size_t len;
|
|
||||||
{
|
{
|
||||||
unsigned long int dstp = (long int) dstpp;
|
return memcpy (dest, src, len) + len;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
libc_hidden_def (__mempcpy)
|
libc_hidden_def (__mempcpy)
|
||||||
weak_alias (__mempcpy, mempcpy)
|
weak_alias (__mempcpy, mempcpy)
|
||||||
|
Loading…
Reference in New Issue
Block a user