From 4dfb853d1935ae0ab4c5be187a82f832efc32fd8 Mon Sep 17 00:00:00 2001 From: bernie Date: Sun, 1 Aug 2004 01:21:17 +0000 Subject: [PATCH] LIKELY(), UNLIKELY(): New compiler-specific macros. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@98 38d2e660-2303-0410-9eaa-f027e97ec537 --- compiler.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler.h b/compiler.h index 62331972..0f6e8f7b 100755 --- a/compiler.h +++ b/compiler.h @@ -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 @@ -129,6 +132,8 @@ #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 @@ -198,6 +203,12 @@ #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 -- 2.25.1