diff options
author | Couriersud <couriersud@users.noreply.github.com> | 2009-10-05 21:54:18 +0000 |
---|---|---|
committer | Couriersud <couriersud@users.noreply.github.com> | 2009-10-05 21:54:18 +0000 |
commit | 138d136ea8a747dbc0c27e4fa0e1823a8129a9ca (patch) | |
tree | 77e3792228619cc03378cf756e7aac17179083a6 | |
parent | eb310e99426247798b89bc4961ddd34ad9ac2ab8 (diff) |
Add EXPECTED macro
- This complements the already existing UNEXPECTED
-rw-r--r-- | src/osd/osdcomm.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/osd/osdcomm.h b/src/osd/osdcomm.h index d55af081a50..858c46e12b2 100644 --- a/src/osd/osdcomm.h +++ b/src/osd/osdcomm.h @@ -50,7 +50,8 @@ #define ATTR_CONST __attribute__((const)) #define ATTR_FORCE_INLINE __attribute__((always_inline)) #define ATTR_NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) -#define UNEXPECTED(exp) __builtin_expect((exp), 0) +#define UNEXPECTED(exp) __builtin_expect(!!(exp), 0) +#define EXPECTED(exp) __builtin_expect(!!(exp), 1) #define RESTRICT __restrict__ #define SETJMP_GNUC_PROTECT() (void)__builtin_return_address(1) #ifndef TYPES_COMPATIBLE @@ -66,6 +67,7 @@ #define ATTR_FORCE_INLINE #define ATTR_NONNULL(...) #define UNEXPECTED(exp) (exp) +#define EXPECTED(exp) (exp) #define RESTRICT #define SETJMP_GNUC_PROTECT() do {} while (0) #ifndef TYPES_COMPATIBLE |