This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
RE: [PATCH] Inline mempcpy
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wilco Dijkstra <wdijkstr at arm dot com>
- Cc: 'Ondřej Bílka' <neleai at seznam dot cz>, <libc-alpha at sourceware dot org>
- Date: Mon, 18 May 2015 17:03:45 +0000
- Subject: RE: [PATCH] Inline mempcpy
- Authentication-results: sourceware.org; auth=none
- References: <A610E03AD50BFC4D95529A36D37FA55E769A83F7F7 at GEORGE dot Emea dot Arm dot com> <000201d0915f$87bb15d0$97314170$ at com> <alpine dot DEB dot 2 dot 10 dot 1505181152420 dot 4225 at digraph dot polyomino dot org dot uk> <000301d09180$ef6e9eb0$ce4bdc10$ at com>
On Mon, 18 May 2015, Wilco Dijkstra wrote:
> #if defined __USE_GNU && defined __OPTIMIZE__ && defined __extern_always_inline
> # if !defined _FORCE_INLINES && !defined _HAVE_STRING_ARCH_mempcpy
>
> #undef mempcpy
> #undef __mempcpy
> #define mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
> #define __mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
>
> __extern_always_inline void *
> __mempcpy_inline (void *__restrict __dest,
> const void *__restrict __src, size_t __n)
> {
> return (char *) memcpy (__dest, __src, __n) + __n;
> }
>
> # endif
> #endif
This seems plausible, subject to getting per-architecture agreement (for
each architecture with mempcpy.S) on whether to define
_HAVE_STRING_ARCH_mempcpy. Although there may be the question of whether
__extern_always_inline should be defined at all for !__GNUC_PREREQ (3,2)
(i.e. when the always_inline attribute isn't supported).
--
Joseph S. Myers
joseph@codesourcery.com