Date: Fri, 4 May 2018 04:00:48 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333240 - in head/sys: powerpc/powerpc sys Message-ID: <201805040400.w4440moH025057@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri May 4 04:00:48 2018 New Revision: 333240 URL: https://svnweb.freebsd.org/changeset/base/333240 Log: Allow __builtin_memmove instead of bcopy for small buffers of known size See r323329 for an explanation why this is a good idea. Modified: head/sys/powerpc/powerpc/bcopy.c head/sys/sys/systm.h Modified: head/sys/powerpc/powerpc/bcopy.c ============================================================================== --- head/sys/powerpc/powerpc/bcopy.c Fri May 4 03:44:12 2018 (r333239) +++ head/sys/powerpc/powerpc/bcopy.c Fri May 4 04:00:48 2018 (r333240) @@ -143,7 +143,7 @@ done: } void -bcopy(const void *src0, void *dst0, size_t length) +(bcopy)(const void *src0, void *dst0, size_t length) { memcpy(dst0, src0, length); Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Fri May 4 03:44:12 2018 (r333239) +++ head/sys/sys/systm.h Fri May 4 04:00:48 2018 (r333240) @@ -259,6 +259,12 @@ void hexdump(const void *ptr, int length, const char * #define ovbcopy(f, t, l) bcopy((f), (t), (l)) void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); +#define bcopy(from, to, len) ({ \ + if (__builtin_constant_p(len) && (len) <= 64) \ + __builtin_memmove((to), (from), (len)); \ + else \ + bcopy((from), (to), (len)); \ +}) void bzero(void * _Nonnull buf, size_t len); #define bzero(buf, len) ({ \ if (__builtin_constant_p(len) && (len) <= 64) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805040400.w4440moH025057>