summaryrefslogtreecommitdiff
path: root/include/gras/gras.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/gras/gras.hpp')
-rw-r--r--include/gras/gras.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/gras/gras.hpp b/include/gras/gras.hpp
index 748e682..6d1808b 100644
--- a/include/gras/gras.hpp
+++ b/include/gras/gras.hpp
@@ -57,6 +57,15 @@
#define GRAS_FORCE_INLINE inline
#endif
+//want to have fun with branch prediction hints?
+#ifdef __GNUC__
+ #define GRAS_LIKELY(expr) (__builtin_expect(bool(expr), 1))
+ #define GRAS_UNLIKELY(expr) (__builtin_expect(bool(expr), 0))
+#else
+ #define GRAS_LIKELY(expr) (expr)
+ #define GRAS_UNLIKELY(expr) (expr)
+#endif
+
namespace gras
{
//! Typedef for absolute item indexes