Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/fpu fpu_subr.c: Convert #ifdef DIAGNOSTIC p...



details:   https://anonhg.NetBSD.org/src/rev/a3fb53ed42d4
branches:  trunk
changeset: 369820:a3fb53ed42d4
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Sep 02 12:29:58 2022 +0000

description:
fpu_subr.c: Convert #ifdef DIAGNOSTIC panic() --> KASSERT{,MSG}().

diffstat:

 sys/arch/powerpc/fpu/fpu_subr.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (43 lines):

diff -r d237076a0174 -r a3fb53ed42d4 sys/arch/powerpc/fpu/fpu_subr.c
--- a/sys/arch/powerpc/fpu/fpu_subr.c   Fri Sep 02 12:24:54 2022 +0000
+++ b/sys/arch/powerpc/fpu/fpu_subr.c   Fri Sep 02 12:29:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_subr.c,v 1.6 2022/09/01 06:10:58 rin Exp $ */
+/*     $NetBSD: fpu_subr.c,v 1.7 2022/09/02 12:29:58 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.6 2022/09/01 06:10:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.7 2022/09/02 12:29:58 rin Exp $");
 
 #include <sys/types.h>
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -72,10 +72,8 @@
        u_int m0, m1, m2, m3, s;
        int lsh;
 
-#ifdef DIAGNOSTIC
-       if (rsh <= 0 || (fp->fp_class != FPC_NUM && !ISNAN(fp)))
-               panic("fpu_rightshift 1");
-#endif
+       KASSERTMSG(rsh > 0 && (fp->fp_class == FPC_NUM || ISNAN(fp)),
+           "rsh %d, class %d\n", rsh, fp->fp_class);
 
        m0 = fp->fp_mant[0];
        m1 = fp->fp_mant[1];
@@ -84,10 +82,7 @@
 
        /* If shifting all the bits out, take a shortcut. */
        if (rsh >= FP_NMANT) {
-#ifdef DIAGNOSTIC
-               if ((m0 | m1 | m2 | m3) == 0)
-                       panic("fpu_rightshift 2");
-#endif
+               KASSERT((m0 | m1 | m2 | m3) != 0);
                fp->fp_mant[0] = 0;
                fp->fp_mant[1] = 0;
                fp->fp_mant[2] = 0;



Home | Main Index | Thread Index | Old Index