QPMS
Electromagnetic multiple scattering library and toolkit.
optim.h
Go to the documentation of this file.
1 
4 #ifndef QPMS_OPTIM_H
5 #define QPMS_OPTIM_H
6 
7 
8 #if ((defined __GNUC__) || (defined __clang__)) && !(defined QPMS_NO_BUILTIN_EXPECT)
10 
13 #define QPMS_EXPECT(exp, c) __builtin_expect(exp, c)
14 #define QPMS_LIKELY(x) __builtin_expect(!!(x), 1)
15 #define QPMS_UNLIKELY(x) __builtin_expect(!!(x), 0)
16 #else
17 #define QPMS_LIKELY(x) (x)
18 #define QPMS_UNLIKELY(x)
19 #define QPMS_EXPECT(exp,c) (exp)
20 #endif
21 
22 #if (defined(__GNUC__) && __GNUC__ >= 3) || \
23  (defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 8)
24 // TODO clang
25 #define QPMS_NORETURN __attribute__((noreturn))
26 #endif
27 
28 #endif // OPTIM_H