summaryrefslogtreecommitdiff
path: root/defines.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-09-03 05:33:25 +1000
committerDamien Miller <djm@mindrot.org>2014-09-03 05:33:25 +1000
commit23f269562b7537b2f6f5014e50a25e5dcc55a837 (patch)
tree86cae8862abbdb5c726a557aeacabd9f0eca3592 /defines.h
parent41c8de2c0031cf59e7cf0c06b5bcfbf4852c1fda (diff)
- (djm) [defines.h sshbuf.c] Move __predict_true|false to defines.h and
conditionalise to avoid duplicate definition.
Diffstat (limited to 'defines.h')
-rw-r--r--defines.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/defines.h b/defines.h
index f1deafa6..3ac8be98 100644
--- a/defines.h
+++ b/defines.h
@@ -25,7 +25,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
-/* $Id: defines.h,v 1.182 2014/06/16 12:50:56 dtucker Exp $ */
+/* $Id: defines.h,v 1.183 2014/09/02 19:33:26 djm Exp $ */
/* Constants */
@@ -830,4 +830,15 @@ struct winsize {
# endif
#endif
+#ifndef __predict_true
+# if defined(__GNUC__) && \
+ ((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
+# define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
+# define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
+# else
+# define __predict_true(exp) ((exp) != 0)
+# define __predict_false(exp) ((exp) != 0)
+# endif /* gcc version */
+#endif /* __predict_true */
+
#endif /* _DEFINES_H */