summaryrefslogtreecommitdiff
path: root/libmpx/mpxwrap/mpx_wrappers.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmpx/mpxwrap/mpx_wrappers.c')
-rw-r--r--libmpx/mpxwrap/mpx_wrappers.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libmpx/mpxwrap/mpx_wrappers.c b/libmpx/mpxwrap/mpx_wrappers.c
index ffa7e7ee5ff..d4c83ef484c 100644
--- a/libmpx/mpxwrap/mpx_wrappers.c
+++ b/libmpx/mpxwrap/mpx_wrappers.c
@@ -483,7 +483,18 @@ __mpx_wrapper_memmove (void *dst, const void *src, size_t n)
__bnd_chk_ptr_bounds (dst, n);
__bnd_chk_ptr_bounds (src, n);
+ /* When we copy exactly one pointer it is faster to
+ just use bndldx + bndstx. */
+ if (n == sizeof (void *))
+ {
+ void *const *s = (void *const *) src;
+ void **d = (void **) dst;
+ *d = *s;
+ return dst;
+ }
+
memmove (dst, src, n);
+
/* Not necessary to copy bounds if size is less then size of pointer
or SRC==DST. */
if ((n >= sizeof (void *)) && (src != dst))