summaryrefslogtreecommitdiff
path: root/sys/arch/hp300/dev/maskbits.h
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-08-05 09:58:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-08-05 09:58:58 +0000
commit2fb74d6b81e739f3c46908c5322a3b7c6bb4c964 (patch)
treedf6806e40cdcc6da46f7d64c91d97dc6f15ae4d4 /sys/arch/hp300/dev/maskbits.h
parent8a82d4c8e145fb0d9eded17d545af66b4c6bcfc3 (diff)
Since the maskbits code only gets invoked with RR_COPY or RR_CLEAR those
days, simplify and inline more of it, to avoid doing unnecessary dest and/or source loads. A copy of the old maskbits.h is moved to stand/ as the ite code there needs the complete RR_ code.
Diffstat (limited to 'sys/arch/hp300/dev/maskbits.h')
-rw-r--r--sys/arch/hp300/dev/maskbits.h46
1 files changed, 10 insertions, 36 deletions
diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h
index 79675fb127f..cca65807aff 100644
--- a/sys/arch/hp300/dev/maskbits.h
+++ b/sys/arch/hp300/dev/maskbits.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: maskbits.h,v 1.5 2005/01/14 22:39:26 miod Exp $ */
+/* $OpenBSD: maskbits.h,v 1.6 2006/08/05 09:58:56 miod Exp $ */
/* $NetBSD: maskbits.h,v 1.3 1997/03/31 07:37:28 scottr Exp $ */
/*-
@@ -41,9 +41,9 @@ SCREEN LEFT SCREEN RIGHT
in this file and maskbits.c, left and right refer to screen coordinates,
NOT bit numbering in registers.
-starttab[n]
+rasops_lmask[n]
bits[0,n-1] = 0 bits[n,31] = 1
-endtab[n] =
+rasops_rmask[n] =
bits[0,n-1] = 1 bits[n,31] = 0
maskbits(x, w, startmask, endmask, nlw)
@@ -55,8 +55,8 @@ and the number of whole longwords between the ends.
#define maskbits(x, w, startmask, endmask, nlw) \
do { \
- startmask = starttab[(x) & 0x1f]; \
- endmask = endtab[((x) + (w)) & 0x1f]; \
+ startmask = rasops_lmask[(x) & 0x1f]; \
+ endmask = rasops_rmask[((x) + (w)) & 0x1f]; \
if (startmask) \
nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
else \
@@ -74,43 +74,17 @@ do { \
#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); \
+ unsigned int _tmpdst; \
+ if (rop == RR_CLEAR) \
+ _tmpdst = 0; \
+ else \
+ FASTGETBITS(psrc, srcbit, width, _tmpdst); \
FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
} while (0)
-#define getandputrop0(psrc, srcbit, width, pdst, rop) \
- getandputrop(psrc, srcbit, 0, width, pdst, rop)
-
#define getunalignedword(psrc, x, dst) \
do { \
int _tmp; \
FASTGETBITS(psrc, x, 32, _tmp); \
dst = _tmp; \
} while (0)
-
-#define fnCLEAR(src, dst) (0)
-#define fnCOPY(src, dst) (src)
-#define fnXOR(src, dst) ((src) ^ (dst))
-#define fnCOPYINVERTED(src, dst) (~(src))
-
-#define DoRop(result, alu, src, dst) \
-do { \
- switch (alu) { \
- case RR_CLEAR: \
- default: \
- result = fnCLEAR(src, dst); \
- break; \
- case RR_COPY: \
- result = fnCOPY(src, dst); \
- break; \
- case RR_XOR: \
- result = fnXOR(src, dst); \
- break; \
- case RR_COPYINVERTED: \
- result = fnCOPYINVERTED(src, dst); \
- break; \
- } \
-} while (0)