From 06eb1e603f9527c1cf205d630fa5c58bd808f9fb Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Thu, 9 Jul 2015 15:30:18 +0300 Subject: Add new attributes to control/improve branch predictions --- src/ffts_attributes.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/ffts_attributes.h') diff --git a/src/ffts_attributes.h b/src/ffts_attributes.h index 763a6af..bdfd616 100644 --- a/src/ffts_attributes.h +++ b/src/ffts_attributes.h @@ -96,4 +96,16 @@ #define FFTS_ASSUME_ALIGNED_32(x) x #endif +#if defined(__GNUC__) +#define FFTS_LIKELY(cond) __builtin_expect(!!(cond), 1) +#else +#define FFTS_LIKELY(cond) cond +#endif + +#if defined(__GNUC__) +#define FFTS_UNLIKELY(cond) __builtin_expect(!!(cond), 0) +#else +#define FFTS_UNLIKELY(cond) cond +#endif + #endif /* FFTS_ATTRIBUTES_H */ -- cgit v1.1