Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libkern __predict_true() the expressions passed to t...



details:   https://anonhg.NetBSD.org/src/rev/c7d588df542a
branches:  trunk
changeset: 485933:c7d588df542a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon May 08 23:33:15 2000 +0000

description:
__predict_true() the expressions passed to the assert family, so
as to move the calls to __assert() out-of-line.

Suggested by Bill Sommerfeld.

diffstat:

 sys/lib/libkern/libkern.h |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r 39aa30e8ed8d -r c7d588df542a sys/lib/libkern/libkern.h
--- a/sys/lib/libkern/libkern.h Mon May 08 23:13:42 2000 +0000
+++ b/sys/lib/libkern/libkern.h Mon May 08 23:33:15 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libkern.h,v 1.29 2000/03/29 03:07:52 simonb Exp $      */
+/*     $NetBSD: libkern.h,v 1.30 2000/05/08 23:33:15 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -117,10 +117,10 @@
 #define        assert(e)       ((void)0)
 #else
 #ifdef __STDC__
-#define        assert(e)       ((e) ? (void)0 :                                    \
+#define        assert(e)       (__predict_true((e)) ? (void)0 :                    \
                            __assert("", __FILE__, __LINE__, #e))
 #else
-#define        assert(e)       ((e) ? (void)0 :                                    \
+#define        assert(e)       (__predict_true((e)) ? (void)0 :                    \
                            __assert("", __FILE__, __LINE__, "e"))
 #endif
 #endif
@@ -129,10 +129,10 @@
 #define        KASSERT(e)      ((void)0)
 #else
 #ifdef __STDC__
-#define        KASSERT(e)      ((e) ? (void)0 :                                    \
+#define        KASSERT(e)      (__predict_true((e)) ? (void)0 :                    \
                            __assert("diagnostic ", __FILE__, __LINE__, #e))
 #else
-#define        KASSERT(e)      ((e) ? (void)0 :                                    \
+#define        KASSERT(e)      (__predict_true((e)) ? (void)0 :                    \
                            __assert("diagnostic ", __FILE__, __LINE__, "e"))
 #endif
 #endif
@@ -141,10 +141,10 @@
 #define        KDASSERT(e)     ((void)0)
 #else
 #ifdef __STDC__
-#define        KDASSERT(e)     ((e) ? (void)0 :                                    \
+#define        KDASSERT(e)     (__predict_true((e)) ? (void)0 :                    \
                            __assert("debugging ", __FILE__, __LINE__, #e))
 #else
-#define        KDASSERT(e)     ((e) ? (void)0 :                                    \
+#define        KDASSERT(e)     (__predict_true((e)) ? (void)0 :                    \
                            __assert("debugging ", __FILE__, __LINE__, "e"))
 #endif
 #endif



Home | Main Index | Thread Index | Old Index