Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 pmap_unwire - deobfuscate.



details:   https://anonhg.NetBSD.org/src/rev/a4a4889b4b30
branches:  trunk
changeset: 936692:a4a4889b4b30
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Aug 01 20:54:23 2020 +0000

description:
pmap_unwire - deobfuscate.

Don't hide assignments inside if ().  Remove redundant entry == 0 test
b/c _PG_WIRED test afterwards covers that and the compiler actually
elimiates it anyway.  Same object code is generated.

diffstat:

 sys/arch/sh3/sh3/pmap.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r dbad276652e2 -r a4a4889b4b30 sys/arch/sh3/sh3/pmap.c
--- a/sys/arch/sh3/sh3/pmap.c   Sat Aug 01 19:19:05 2020 +0000
+++ b/sys/arch/sh3/sh3/pmap.c   Sat Aug 01 20:54:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $    */
+/*     $NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $    */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.82 2017/02/02 21:35:29 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.83 2020/08/01 20:54:23 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -736,9 +736,12 @@
 {
        pt_entry_t *pte, entry;
 
-       if ((pte = __pmap_pte_lookup(pmap, va)) == NULL ||
-           (entry = *pte) == 0 ||
-           (entry & _PG_WIRED) == 0)
+       pte = __pmap_pte_lookup(pmap, va);
+       if (pte == NULL)
+               return;
+
+       entry = *pte;
+       if ((entry & _PG_WIRED) == 0)
                return;
 
        *pte = entry & ~_PG_WIRED;



Home | Main Index | Thread Index | Old Index