summaryrefslogtreecommitdiffstats
path: root/libdimension/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/compiler.h')
-rw-r--r--libdimension/compiler.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/libdimension/compiler.h b/libdimension/compiler.h
index 0500762..fb6c80f 100644
--- a/libdimension/compiler.h
+++ b/libdimension/compiler.h
@@ -29,16 +29,22 @@
#include <stdbool.h>
#ifdef DMNSN_PROFILE
-#define dmnsn_likely(test) \
- dmnsn_expect(!!(test), true, DMNSN_FUNC, __FILE__, __LINE__)
-#define dmnsn_unlikely(test) \
- dmnsn_expect(!!(test), false, DMNSN_FUNC, __FILE__, __LINE__)
+ #define dmnsn_likely(test) \
+ dmnsn_expect(!!(test), true, DMNSN_FUNC, __FILE__, __LINE__)
+ #define dmnsn_unlikely(test) \
+ dmnsn_expect(!!(test), false, DMNSN_FUNC, __FILE__, __LINE__)
#elif defined(__GNUC__)
-#define dmnsn_likely(test) __builtin_expect(!!(test), true)
-#define dmnsn_unlikely(test) __builtin_expect(!!(test), false)
+ #define dmnsn_likely(test) __builtin_expect(!!(test), true)
+ #define dmnsn_unlikely(test) __builtin_expect(!!(test), false)
#else
-#define dmnsn_likely(test) (test)
-#define dmnsn_unlikely(test) (test)
+ #define dmnsn_likely(test) (test)
+ #define dmnsn_unlikely(test) (test)
+#endif
+
+#ifdef __GNUC__
+ #define DMNSN_HOT __attribute__((hot))
+#else
+ #define DMNSN_HOT
#endif
#endif /* DIMENSION_IMPL_COMPILER_H */