From 9834d09359d0d84b37eed30c8707c443b9c310c1 Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sun, 19 Mar 2006 06:50:13 +0000 Subject: [PATCH] - TAB/space cleanup - use do{}while(/*CONSTCOND*/0) for macro with multiple statements --- sys/arch/hp300/dev/grf_hy.c | 16 +++--- sys/arch/hp300/dev/maskbits.h | 95 ++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/sys/arch/hp300/dev/grf_hy.c b/sys/arch/hp300/dev/grf_hy.c index 23c3afb7a899..d10a5b0108fe 100644 --- a/sys/arch/hp300/dev/grf_hy.c +++ b/sys/arch/hp300/dev/grf_hy.c @@ -1,4 +1,4 @@ -/* $NetBSD: grf_hy.c,v 1.26 2005/12/11 12:17:14 christos Exp $ */ +/* $NetBSD: grf_hy.c,v 1.27 2006/03/19 06:50:13 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -120,7 +120,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: grf_hy.c,v 1.26 2005/12/11 12:17:14 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grf_hy.c,v 1.27 2006/03/19 06:50:13 tsutsui Exp $"); #include "opt_compat_hpux.h" @@ -641,12 +641,12 @@ hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, dstBit = dx & 0x1f; while (h--) { - getandputrop(psrc, srcBit, dstBit, w, pdst, func) + getandputrop(psrc, srcBit, dstBit, w, pdst, func); pdst += width; psrc += width; } } else { - maskbits(dx, w, startmask, endmask, nlMiddle) + maskbits(dx, w, startmask, endmask, nlMiddle); if (startmask) nstart = 32 - (dx & 0x1f); else @@ -670,7 +670,7 @@ hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, if (startmask) { getandputrop(psrc, (sx & 0x1f), - (dx & 0x1f), nstart, pdst, func) + (dx & 0x1f), nstart, pdst, func); pdst++; if (srcStartOver) psrc++; @@ -688,7 +688,7 @@ hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, nl = nlMiddle + 1; while (--nl) { getunalignedword(psrc, - xoffSrc, tmpSrc) + xoffSrc, tmpSrc); DoRop(*pdst, func, tmpSrc, *pdst); pdst++; @@ -728,7 +728,7 @@ hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, while (--nl) { --psrc; --pdst; - getunalignedword(psrc, xoffSrc, tmpSrc) + getunalignedword(psrc, xoffSrc, tmpSrc); DoRop(*pdst, func, tmpSrc, *pdst); } @@ -737,7 +737,7 @@ hyper_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h, --psrc; --pdst; getandputrop(psrc, (sx & 0x1f), - (dx & 0x1f), nstart, pdst, func) + (dx & 0x1f), nstart, pdst, func); } pdstLine += width; diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h index f893c9011244..345d4655b65d 100644 --- a/sys/arch/hp300/dev/maskbits.h +++ b/sys/arch/hp300/dev/maskbits.h @@ -1,4 +1,4 @@ -/* $NetBSD: maskbits.h,v 1.7 2005/12/24 22:45:35 perry Exp $ */ +/* $NetBSD: maskbits.h,v 1.8 2006/03/19 06:50:13 tsutsui Exp $ */ /*- * Copyright (c) 1994 @@ -52,40 +52,43 @@ and the number of whole longwords between the ends. */ -#define maskbits(x, w, startmask, endmask, nlw) \ - startmask = starttab[(x)&0x1f]; \ - endmask = endtab[((x)+(w)) & 0x1f]; \ - if (startmask) \ - nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ - else \ - nlw = (w) >> 5; +#define maskbits(x, w, startmask, endmask, nlw) \ +do { \ + startmask = starttab[(x) & 0x1f]; \ + endmask = endtab[((x)+(w)) & 0x1f]; \ + if (startmask) \ + nlw = (((w) - (32 - ((x)&0x1f))) >> 5); \ + else \ + nlw = (w) >> 5; \ +} while (/* CONSTCOND */ 0) -#define FASTGETBITS(psrc, x, w, dst) \ - __asm ("bfextu %3{%1:%2},%0" \ - : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) +#define FASTGETBITS(psrc, x, w, dst) \ + __asm ("bfextu %3{%1:%2},%0" \ + : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc))) -#define FASTPUTBITS(src, x, w, pdst) \ - __asm ("bfins %3,%0{%1:%2}" \ - : "=o" (*(char *)(pdst)) \ - : "di" (x), "di" (w), "d" (src)) +#define FASTPUTBITS(src, x, w, pdst) \ + __asm ("bfins %3,%0{%1:%2}" \ + : "=o" (*(char *)(pdst)) \ + : "di" (x), "di" (w), "d" (src)) -#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ -{ \ - unsigned int _tmpsrc, _tmpdst; \ - FASTGETBITS(pdst, dstbit, width, _tmpdst); \ - FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ - DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \ - FASTPUTBITS(_tmpdst, dstbit, width, pdst); \ -} +#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \ +do { \ + unsigned int _tmpsrc, _tmpdst; \ + FASTGETBITS(pdst, dstbit, width, _tmpdst); \ + FASTGETBITS(psrc, srcbit, width, _tmpsrc); \ + DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \ + FASTPUTBITS(_tmpdst, dstbit, width, pdst); \ +} while (/* CONSTCOND */ 0) #define getandputrop0(psrc, srcbit, width, pdst, rop) \ - getandputrop(psrc, srcbit, 0, width, pdst, rop) + getandputrop(psrc, srcbit, 0, width, pdst, rop) -#define getunalignedword(psrc, x, dst) { \ - int _tmp; \ - FASTGETBITS(psrc, x, 32, _tmp); \ - dst = _tmp; \ -} +#define getunalignedword(psrc, x, dst) \ +do { \ + int _tmp; \ + FASTGETBITS(psrc, x, 32, _tmp); \ + dst = _tmp; \ +} while (/* CONSTCOND */ 0) #define fnCLEAR(src, dst) (0) #define fnCOPY(src, dst) (src) @@ -93,20 +96,20 @@ and the number of whole longwords between the ends. #define fnCOPYINVERTED(src, dst)(~src) #define DoRop(result, alu, src, dst) \ -{ \ - if (alu == RR_COPY) \ - result = fnCOPY (src, dst); \ - else \ - switch (alu) \ - { \ - case RR_CLEAR: \ - result = fnCLEAR (src, dst); \ - break; \ - case RR_XOR: \ - result = fnXOR (src, dst); \ - break; \ - case RR_COPYINVERTED: \ - result = fnCOPYINVERTED (src, dst); \ - break; \ - } \ -} +do { \ + if (alu == RR_COPY) \ + result = fnCOPY (src, dst); \ + else { \ + switch (alu) { \ + case RR_CLEAR: \ + result = fnCLEAR (src, dst); \ + break; \ + case RR_XOR: \ + result = fnXOR (src, dst); \ + break; \ + case RR_COPYINVERTED: \ + result = fnCOPYINVERTED (src, dst); \ + break; \ + } \ + } \ +} while (/* CONSTCOND */ 0)