[Bf-blender-cvs] [43fb105] master: Move LIKELY/UNLIKELY into header

Campbell Barton noreply at git.blender.org
Sun Apr 6 09:26:23 CEST 2014


Commit: 43fb105ff11b4654e5ce6443ad92a71bf9320757
Author: Campbell Barton
Date:   Sun Apr 6 17:25:50 2014 +1000
https://developer.blender.org/rB43fb105ff11b4654e5ce6443ad92a71bf9320757

Move LIKELY/UNLIKELY into header

===================================================================

M	intern/guardedalloc/intern/mallocn.c
M	intern/guardedalloc/intern/mallocn_guarded_impl.c
M	intern/guardedalloc/intern/mallocn_intern.h
M	intern/guardedalloc/intern/mallocn_lockfree_impl.c

===================================================================

diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 4d00616..e85fba7 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 d86adcf..172c79d5 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -222,14 +222,6 @@ static bool malloc_debug_memset = false;
 /* --------------------------------------------------------------------- */
 
 #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
 static void print_error(const char *str, ...)
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index db45b59..b0fd52d 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 ccda439..6fc0180 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
@@ -64,14 +59,6 @@ static void (*thread_unlock_callback)(void) = NULL;
 #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
 static void print_error(const char *str, ...)




More information about the Bf-blender-cvs mailing list