LIKELY(), UNLIKELY(): New compiler-specific macros.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 1 Aug 2004 01:21:17 +0000 (01:21 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Sun, 1 Aug 2004 01:21:17 +0000 (01:21 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@98 38d2e660-2303-0410-9eaa-f027e97ec537

compiler.h

index 62331972442a4e226e7363a08fadbd8fcdbe1145..0f6e8f7b423dcd81e79556e58005f53470ed077c 100755 (executable)
@@ -15,6 +15,9 @@
 
 /*
  * $Log$
+ * Revision 1.12  2004/08/01 01:21:17  bernie
+ * LIKELY(), UNLIKELY(): New compiler-specific macros.
+ *
  * Revision 1.11  2004/07/30 14:34:10  rasky
  * Vari fix per documentazione e commenti
  * Aggiunte PP_CATn e STATIC_ASSERT
        #define NORETURN                __attribute__((__noreturn__))
        #define UNUSED(type,arg)        __attribute__((__unused__)) type arg
        #define INLINE                  static inline __attribute__((__always_inline__))
+       #define LIKELY(x)               __builtin_expect((x), 1)
+       #define UNLIKELY(x)             __builtin_expect((x), 0)
        #if GNUC_PREREQ(3,1)
                #define DEPRECATED      __attribute__((__deprecated__))
        #endif
 #ifndef INTERRUPT
 #define INTERRUPT(x)           ERROR_NOT_IMPLEMENTED
 #endif
+#ifndef LIKELY
+#define LIKELY(x)              x
+#endif
+#ifndef UNLIKELY
+#define UNLIKELY(x)            x
+#endif
 
 /* Support for harvard architectures */
 #ifndef PSTR