[PATCH] Inline mempcpy
Joseph Myers
joseph@codesourcery.com
Mon May 18 21:02:00 GMT 2015
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
More information about the Libc-alpha
mailing list