summaryrefslogtreecommitdiffstats
path: root/libdimension/compiler.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-02-28 18:12:01 -0500
committerTavian Barnes <tavianator@gmail.com>2011-03-08 21:43:24 -0500
commit54a201552db7477aa04a625fd5bc938ad8c97800 (patch)
tree2d2ff2b2f092e3c603a5c65e3e777c823ddbb3a6 /libdimension/compiler.h
parenta2bf45329a172d2c53594c64d27f1c15ac26796a (diff)
downloaddimension-54a201552db7477aa04a625fd5bc938ad8c97800.tar.xz
New DMNSN_HOT macro.
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 */