From 43fb105ff11b4654e5ce6443ad92a71bf9320757 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 6 Apr 2014 17:25:50 +1000 Subject: Move LIKELY/UNLIKELY into header --- intern/guardedalloc/intern/mallocn.c | 5 ----- intern/guardedalloc/intern/mallocn_guarded_impl.c | 8 -------- intern/guardedalloc/intern/mallocn_intern.h | 8 ++++++++ intern/guardedalloc/intern/mallocn_lockfree_impl.c | 13 ------------- 4 files changed, 8 insertions(+), 26 deletions(-) (limited to 'intern/guardedalloc') diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 4d00616202e..e85fba7a6d0 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -15,11 +15,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): Brecht Van Lommel * Campbell Barton * diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c index d86adcf2a7c..172c79d50cd 100644 --- a/intern/guardedalloc/intern/mallocn_guarded_impl.c +++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c @@ -221,14 +221,6 @@ static bool malloc_debug_memset = false; /* implementation */ /* --------------------------------------------------------------------- */ -#ifdef __GNUC__ -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) -#endif - #ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h index db45b59b884..b0fd52d2766 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.h @@ -77,6 +77,14 @@ #define SIZET_ALIGN_4(len) ((len + 3) & ~(size_t)3) +#ifdef __GNUC__ +# define LIKELY(x) __builtin_expect(!!(x), 1) +# define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +# define LIKELY(x) (x) +# define UNLIKELY(x) (x) +#endif + /* Prototypes for counted allocator functions */ size_t MEM_lockfree_allocN_len(const void *vmemh) ATTR_WARN_UNUSED_RESULT; void MEM_lockfree_freeN(void *vmemh); diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c index ccda439e29a..6fc01807af3 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -15,11 +15,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): Brecht Van Lommel * Campbell Barton * Sergey Sharybin @@ -63,14 +58,6 @@ static void (*thread_unlock_callback)(void) = NULL; #define PTR_FROM_MEMHEAD(memhead) (memhead + 1) #define MEMHEAD_IS_MMAP(memhead) ((memhead)->len & (size_t) 1) -#ifdef __GNUC__ -# define LIKELY(x) __builtin_expect(!!(x), 1) -# define UNLIKELY(x) __builtin_expect(!!(x), 0) -#else -# define LIKELY(x) (x) -# define UNLIKELY(x) (x) -#endif - #ifdef __GNUC__ __attribute__ ((format(printf, 1, 2))) #endif -- cgit v1.2.3