summaryrefslogtreecommitdiff
path: root/ucoolib
diff options
context:
space:
mode:
authorNicolas Schodet2012-12-23 19:00:26 +0100
committerNicolas Schodet2019-10-06 23:29:59 +0200
commit15be5f5871dfe3f3b1f6bcc7efabd0f378e62846 (patch)
tree1b33e244f4d7ee5947f5fc0953549b09cc795120 /ucoolib
parentfd338e8d6f4bfa895847ca045ad00df8009e537a (diff)
ucoolib: add __builtin_expect to assert
Diffstat (limited to 'ucoolib')
-rw-r--r--ucoolib/common.hh4
1 files changed, 2 insertions, 2 deletions
diff --git a/ucoolib/common.hh b/ucoolib/common.hh
index 8376389..4bedaa6 100644
--- a/ucoolib/common.hh
+++ b/ucoolib/common.hh
@@ -59,7 +59,7 @@ halt_perror () __attribute__ ((noreturn));
extern inline void
assert (bool condition)
{
- if (!condition)
+ if (!__builtin_expect (condition, 1))
halt ();
}
@@ -77,7 +77,7 @@ assert_unreachable ()
extern inline void
assert_perror (bool condition)
{
- if (!condition)
+ if (!__builtin_expect (condition, 1))
halt_perror ();
}