diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2009-12-16 16:54:44 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2009-12-16 16:54:44 +0000 |
commit | 5249a3210eddf6176c4e2e6cbbc570f1b71927c7 (patch) | |
tree | 8dae2c0e86a05a01a8c701ac78be16bf8b761d9a | |
parent | ef66f1ee6f7253bd21507949eddf04d281715dfb (diff) |
zap two more handrolled equivalents of nitems().
ok miod@
-rw-r--r-- | sys/arch/hppa64/hppa64/pmap.c | 17 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/db_trace.c | 6 |
2 files changed, 11 insertions, 12 deletions
diff --git a/sys/arch/hppa64/hppa64/pmap.c b/sys/arch/hppa64/hppa64/pmap.c index 49497df07a1..43cc943d358 100644 --- a/sys/arch/hppa64/hppa64/pmap.c +++ b/sys/arch/hppa64/hppa64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.7 2009/04/14 16:01:04 oga Exp $ */ +/* $OpenBSD: pmap.c,v 1.8 2009/12/16 16:54:42 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -393,7 +393,6 @@ const pt_entry_t hppa_pgs[] = { PTE_PG16M, PTE_PG64M }; -#define nhppa_pgs sizeof(hppa_pgs)/sizeof(hppa_pgs[0]) void pmap_maphys(paddr_t spa, paddr_t epa) @@ -407,22 +406,22 @@ pmap_maphys(paddr_t spa, paddr_t epa) s = ffs(spa) - 12; e = ffs(epa) - 12; - if (s < e || (s == e && s / 2 < nhppa_pgs)) { + if (s < e || (s == e && s / 2 < nitems(hppa_pgs))) { i = s / 2; - if (i > nhppa_pgs) - i = nhppa_pgs; + if (i > nitems(hppa_pgs)) + i = nitems(hppa_pgs); pa = spa; spa = tpa = 0x1000 << ((i + 1) * 2); } else if (s > e) { i = e / 2; - if (i > nhppa_pgs) - i = nhppa_pgs; + if (i > nitems(hppa_pgs)) + i = nitems(hppa_pgs); epa = pa = epa & (0xfffff000 << ((i + 1) * 2)); tpa = epa; } else { i = s / 2; - if (i > nhppa_pgs) - i = nhppa_pgs; + if (i > nitems(hppa_pgs)) + i = nitems(hppa_pgs); pa = spa; spa = tpa = epa; } diff --git a/sys/arch/m88k/m88k/db_trace.c b/sys/arch/m88k/m88k/db_trace.c index 7909960d94d..b5201b9b6f6 100644 --- a/sys/arch/m88k/m88k/db_trace.c +++ b/sys/arch/m88k/m88k/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.10 2007/11/17 05:36:23 miod Exp $ */ +/* $OpenBSD: db_trace.c,v 1.11 2009/12/16 16:54:43 jasper Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -165,8 +165,8 @@ m88k_instruction_info(u_int32_t instruction) { 0xfc00ffe0U, 0xf400fc00U, /* rte */ FLOW_CTRL}, { 0xfc000000U, 0xf8000000U, /* tbnd */ 0}, }; -#define ctrl_count (sizeof(control)/sizeof(control[0])) - for (ptr = &control[0]; ptr < &control[ctrl_count]; ptr++) + + for (ptr = &control[0]; ptr < &control[nitems(control)]; ptr++) if ((instruction & ptr->mask) == ptr->value) return ptr->flags; return 0; |