summaryrefslogtreecommitdiffhomepage
path: root/compat/util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/util.hpp')
-rw-r--r--compat/util.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/compat/util.hpp b/compat/util.hpp
index 4ad01544..88bff96c 100644
--- a/compat/util.hpp
+++ b/compat/util.hpp
@@ -46,8 +46,8 @@ template<typename t> using ptr = std::unique_ptr<t>;
#endif
#if defined __GNUC__
-# define likely(x) __builtin_expect((x),1)
-# define unlikely(x) __builtin_expect((x),0)
+# define likely(x) __builtin_expect(!!(x),1)
+# define unlikely(x) __builtin_expect(!!(x),0)
#else
# define likely(x) (x)
# define unlikely(x) (x)
@@ -108,6 +108,14 @@ template<typename t> using qshared = QSharedPointer<t>;
#endif
#if defined _MSC_VER
+# define restrict_ref restrict
+#elif defined __GNUG__
+# define restrict_ref restrict
+#else
+# define restrict_ref
+#endif
+
+#if defined _MSC_VER
# define force_inline __forceinline
#elif defined __GNUG__
# define force_inline __attribute__((always_inline, gnu_inline))