Module Name:    src
Committed By:   rin
Date:           Thu Jul 25 02:26:32 UTC 2019

Modified Files:
        src/sys/dev/rasops: rasops.c rasops1.c rasops15.c rasops2.c rasops24.c
            rasops4.c rasops8.c rasops_bitops.h

Log Message:
Misc cleen up:
- Make 32bit mask unsigned
- DPRINTF --> __nothing ifndef DEBUG_RASOPS
- "#ifdef DIAGNOSTIC if (x) panic(); #endif" --> KASSERT(!x);
- KNF

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/rasops/rasops4.c \
    src/sys/dev/rasops/rasops_bitops.h
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/rasops/rasops8.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.87 src/sys/dev/rasops/rasops.c:1.88
--- src/sys/dev/rasops/rasops.c:1.87	Thu Jul 25 00:55:13 2019
+++ src/sys/dev/rasops/rasops.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.87 2019/07/25 00:55:13 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.88 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.87 2019/07/25 00:55:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.88 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -54,9 +54,9 @@ __KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1
 #endif
 
 #ifdef RASOPS_DEBUG
-#define DPRINTF aprint_error
+#define DPRINTF(...) aprint_error(...)
 #else
-#define DPRINTF while (0) printf
+#define DPRINTF(...) __nothing
 #endif
 
 struct rasops_matchdata {
@@ -223,7 +223,7 @@ rasops_init(struct rasops_info *ri, int 
 		 */
 		if (cookie <= 0) {
 			aprint_error("rasops_init: font table is empty\n");
-			return (-1);
+			return -1;
 		}
 
 #if NRASOPS_ROTATION > 0
@@ -241,7 +241,7 @@ rasops_init(struct rasops_info *ri, int 
 
 		if (wsfont_lock(cookie, &ri->ri_font)) {
 			aprint_error("rasops_init: couldn't lock font\n");
-			return (-1);
+			return -1;
 		}
 
 		ri->ri_wsfcookie = cookie;
@@ -251,21 +251,23 @@ rasops_init(struct rasops_info *ri, int 
 	/* This should never happen in reality... */
 #ifdef DEBUG
 	if ((long)ri->ri_bits & 3) {
-		aprint_error("rasops_init: bits not aligned on 32-bit boundary\n");
-		return (-1);
+		aprint_error(
+		    "rasops_init: bits not aligned on 32-bit boundary\n");
+		return -1;
 	}
 
 	if ((int)ri->ri_stride & 3) {
-		aprint_error("rasops_init: stride not aligned on 32-bit boundary\n");
-		return (-1);
+		aprint_error(
+		    "rasops_init: stride not aligned on 32-bit boundary\n");
+		return -1;
 	}
 #endif
 
 	if (rasops_reconfig(ri, wantrows, wantcols))
-		return (-1);
+		return -1;
 
 	rasops_init_devcmap(ri);
-	return (0);
+	return 0;
 }
 
 /*
@@ -392,7 +394,8 @@ rasops_reconfig(struct rasops_info *ri, 
 		if (ri->ri_hwbits != NULL) {
 			ri->ri_hwbits += (((ri->ri_width * bpp >> 3) -
 			    ri->ri_emustride) >> 1) & ~3;
-			ri->ri_hwbits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
+			ri->ri_hwbits +=
+			    ((ri->ri_height - ri->ri_emuheight) >> 1) *
 			    ri->ri_stride;
 		}
 		ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits)
@@ -465,7 +468,7 @@ rasops_reconfig(struct rasops_info *ri, 
 	default:
 		ri->ri_flg &= ~RI_CFGDONE;
 		splx(s);
-		return (-1);
+		return -1;
 	}
 
 #if NRASOPS_ROTATION > 0
@@ -490,7 +493,7 @@ rasops_reconfig(struct rasops_info *ri, 
 
 	ri->ri_flg |= RI_CFGDONE;
 	splx(s);
-	return (0);
+	return 0;
 }
 
 /*
@@ -503,29 +506,26 @@ rasops_mapchar(void *cookie, int c, u_in
 
 	ri = (struct rasops_info *)cookie;
 
-#ifdef DIAGNOSTIC
-	if (ri->ri_font == NULL)
-		panic("rasops_mapchar: no font selected");
-#endif
+	KASSERT(ri->ri_font != NULL);
 
 	if ( (c = wsfont_map_unichar(ri->ri_font, c)) < 0) {
 		*cp = ' ';
-		return (0);
+		return 0;
 	}
 
 	if (c < ri->ri_font->firstchar) {
 		*cp = ' ';
-		return (0);
+		return 0;
 	}
 
 #if 0
 	if (c - ri->ri_font->firstchar >= ri->ri_font->numchars) {
 		*cp = ' ';
-		return (0);
+		return 0;
 	}
 #endif
 	*cp = c;
-	return (5);
+	return 5;
 }
 
 /*
@@ -539,14 +539,14 @@ rasops_allocattr_color(void *cookie, int
 
 	if (__predict_false((unsigned int)fg >= sizeof(rasops_isgray) ||
 	    (unsigned int)bg >= sizeof(rasops_isgray)))
-		return (EINVAL);
+		return EINVAL;
 
 #ifdef RASOPS_CLIPPING
 	fg &= 7;
 	bg &= 7;
 #endif
 	if ((flg & WSATTR_BLINK) != 0)
-		return (EINVAL);
+		return EINVAL;
 
 	if ((flg & WSATTR_WSCOLORS) == 0) {
 #ifdef WS_DEFAULT_FG
@@ -579,7 +579,7 @@ rasops_allocattr_color(void *cookie, int
 		flg |= WSATTR_PRIVATE2;
 
 	*attr = (bg << 16) | (fg << 24) | flg;
-	return (0);
+	return 0;
 }
 
 /*
@@ -592,7 +592,7 @@ rasops_allocattr_mono(void *cookie, int 
 	int swap;
 
 	if ((flg & (WSATTR_BLINK | WSATTR_HILIT | WSATTR_WSCOLORS)) != 0)
-		return (EINVAL);
+		return EINVAL;
 
 	fg = 1;
 	bg = 0;
@@ -604,7 +604,7 @@ rasops_allocattr_mono(void *cookie, int 
 	}
 
 	*attr = (bg << 16) | (fg << 24) | ((flg & WSATTR_UNDERLINE) ? 7 : 6);
-	return (0);
+	return 0;
 }
 
 /*
@@ -835,10 +835,10 @@ rasops_init_devcmap(struct rasops_info *
 
 	case 2:
 		for (i = 1; i < 15; i++)
-			ri->ri_devcmap[i] = 0xaaaaaaaa;
+			ri->ri_devcmap[i] = 0xaaaaaaaaU;
 
 		ri->ri_devcmap[0] = 0;
-		ri->ri_devcmap[8] = 0x55555555;
+		ri->ri_devcmap[8] = 0x55555555U;
 		ri->ri_devcmap[15] = -1;
 		return;
 
@@ -1427,10 +1427,12 @@ rasops_copycols_rotated_cw(void *cookie,
 
 	if (src > dst)
 		for (coff = 0; coff < num; coff++)
-			rasops_copychar(cookie, row, row, src + coff, dst + coff);
+			rasops_copychar(cookie, row, row, src + coff,
+			    dst + coff);
 	else
 		for (coff = num - 1; coff >= 0; coff--)
-			rasops_copychar(cookie, row, row, src + coff, dst + coff);
+			rasops_copychar(cookie, row, row, src + coff,
+			    dst + coff);
 }
 
 static void
@@ -1451,7 +1453,8 @@ rasops_eraserows_rotated_cw(void *cookie
  * built-in Sharp W-ZERO3 display in 16bpp).
  */
 static void
-rasops_copychar_ccw(void *cookie, int srcrow, int dstrow, int srccol, int dstcol)
+rasops_copychar_ccw(void *cookie, int srcrow, int dstrow, int srccol,
+    int dstcol)
 {
 	struct rasops_info *ri;
 	uint8_t *sp, *dp;
@@ -1562,7 +1565,7 @@ rasops_make_box_chars_16(struct rasops_i
 
 	vert_mask = 0xc000 >> ((ri->ri_font->fontwidth >> 1) - 1);
 	hmask_left = 0xff00 << (8 - (ri->ri_font->fontwidth >> 1));
-	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */
@@ -1601,7 +1604,7 @@ rasops_make_box_chars_8(struct rasops_in
 
 	vert_mask = 0xc0 >> ((ri->ri_font->fontwidth >> 1) - 1);
 	hmask_left = 0xf0 << (4 - (ri->ri_font->fontwidth >> 1));
-	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */
@@ -1638,9 +1641,9 @@ rasops_make_box_chars_32(struct rasops_i
 	uint32_t *data = (uint32_t *)ri->ri_optfont.data;
 	int c, i, mid;
 
-	vert_mask = 0xc0000000 >> ((ri->ri_font->fontwidth >> 1) - 1);
-	hmask_left = 0xffff0000 << (16 - (ri->ri_font->fontwidth >> 1));
-	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
+	vert_mask = 0xc0000000U >> ((ri->ri_font->fontwidth >> 1) - 1);
+	hmask_left = 0xffff0000U << (16 - (ri->ri_font->fontwidth >> 1));
+	hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1) >> 1);
 	mid = (ri->ri_font->fontheight + 1) >> 1;
 
 	/* 0x00 would be empty anyway so don't bother */
@@ -1731,6 +1734,7 @@ rasops_make_box_chars_alpha(struct rasop
 int
 rasops_get_cmap(struct rasops_info *ri, uint8_t *palette, size_t bytes)
 {
+
 	if ((ri->ri_depth == 8 ) && ((ri->ri_flg & RI_8BIT_IS_RGB) > 0)) {
 		/* generate an R3G3B2 palette */
 		int i, idx = 0;
@@ -1759,8 +1763,7 @@ rasops_get_cmap(struct rasops_info *ri, 
 			palette[idx] = tmp;
 			idx++;
 		}
-	} else {
+	} else
 		memcpy(palette, rasops_cmap, MIN(bytes, sizeof(rasops_cmap)));
-	}
 	return 0;
 }

Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.26 src/sys/dev/rasops/rasops1.c:1.27
--- src/sys/dev/rasops/rasops1.c:1.26	Wed Jul 24 18:33:49 2019
+++ src/sys/dev/rasops/rasops1.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.26 2019/07/24 18:33:49 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.27 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.26 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.27 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -219,11 +219,11 @@ rasops1_putchar(void *cookie, int row, i
 					fb = ~(fr[3] | (fr[2] << 8) |
 					    (fr[1] << 16) | (fr[0] << 24));
 
-					tmp = (rp[0] & lmask)
-					    | MBE((u_int)fb >> col);
+					tmp = (rp[0] & lmask) |
+					    MBE((u_int)fb >> col);
 
-					tmp2 = (rp[1] & rmask)
-					    | (MBE((u_int)fb << width) & ~rmask);
+					tmp2 = (rp[1] & rmask) |
+					    (MBE((u_int)fb << width) & ~rmask);
 					rp[0] = tmp;
 					rp[1] = tmp2;
 					fr += fs;
@@ -239,11 +239,11 @@ rasops1_putchar(void *cookie, int row, i
 					fb = (fr[3] | (fr[2] << 8) |
 					    (fr[1] << 16) | (fr[0] << 24));
 
-					tmp = (rp[0] & lmask)
-					    | MBE(fb >> col);
+					tmp = (rp[0] & lmask) |
+					    MBE(fb >> col);
 
-					tmp2 = (rp[1] & rmask)
-					    | (MBE(fb << width) & ~rmask);
+					tmp2 = (rp[1] & rmask) |
+					    (MBE(fb << width) & ~rmask);
 					rp[0] = tmp;
 					rp[1] = tmp2;
 					fr += fs;

Index: src/sys/dev/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.25 src/sys/dev/rasops/rasops15.c:1.26
--- src/sys/dev/rasops/rasops15.c:1.25	Wed Jul 24 18:33:49 2019
+++ src/sys/dev/rasops/rasops15.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.25 2019/07/24 18:33:49 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.26 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.25 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.26 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -169,7 +169,8 @@ rasops15_putchar(void *cookie, int row, 
 
 		while (height--) {
 			dp = rp;
-			fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
+			fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) |
+			    (fr[0] << 24);
 			fr += font->stride;
 			rp += ri->ri_stride;
 			if (ri->ri_hwbits) {
@@ -373,12 +374,11 @@ rasops15_putchar8(void *cookie, int row,
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
-			rp[0] = rp[1] = rp[2] = rp[3] = c;
+			rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 			if (ri->ri_hwbits) {
-				hrp[0] = hrp[1] = hrp[2] = hrp[3] = c;
+				hrp[0] = hrp[1] = hrp[2] = hrp[3] = stamp[0];
 				DELTA(hrp, ri->ri_stride, uint32_t *);
 			}
 		}
@@ -470,13 +470,13 @@ rasops15_putchar12(void *cookie, int row
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
-			rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+			rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] =
+			    stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 			if (ri->ri_hwbits) {
 				hrp[0] = hrp[1] = hrp[2] = hrp[3] = hrp[4] =
-				    hrp[5] = c;
+				    hrp[5] = stamp[0];
 				DELTA(hrp, ri->ri_stride, uint32_t *);
 			}
 		}
@@ -576,14 +576,13 @@ rasops15_putchar16(void *cookie, int row
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
 			rp[0] = rp[1] = rp[2] = rp[3] =
-			rp[4] = rp[5] = rp[6] = rp[7] = c;
+			rp[4] = rp[5] = rp[6] = rp[7] = stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 			if (ri->ri_hwbits) {
 				hrp[0] = hrp[1] = hrp[2] = hrp[3] =
-				hrp[4] = hrp[5] = hrp[6] = hrp[7] = c;
+				hrp[4] = hrp[5] = hrp[6] = hrp[7] = stamp[0];
 				DELTA(hrp, ri->ri_stride, uint32_t *);
 			}
 		}

Index: src/sys/dev/rasops/rasops2.c
diff -u src/sys/dev/rasops/rasops2.c:1.21 src/sys/dev/rasops/rasops2.c:1.22
--- src/sys/dev/rasops/rasops2.c:1.21	Wed Jul 24 18:33:49 2019
+++ src/sys/dev/rasops/rasops2.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops2.c,v 1.21 2019/07/24 18:33:49 rin Exp $	*/
+/* 	$NetBSD: rasops2.c,v 1.22 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.21 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.22 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -291,9 +291,8 @@ rasops2_putchar8(void *cookie, int row, 
 		rasops2_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint8_t c = stamp[0];
 		while (height--) {
-			*(uint16_t *)rp = c;
+			*(uint16_t *)rp = stamp[0];
 			rp += rs;
 		}
 	} else {
@@ -356,9 +355,8 @@ rasops2_putchar12(void *cookie, int row,
 		rasops2_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint8_t c = stamp[0];
 		while (height--) {
-			rp[0] = rp[1] = rp[2] = c;
+			rp[0] = rp[1] = rp[2] = stamp[0];
 			rp += rs;
 		}
 	} else {
@@ -424,9 +422,8 @@ rasops2_putchar16(void *cookie, int row,
 		rasops2_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint8_t c = stamp[0];
 		while (height--) {
-			*(uint32_t *)rp = c;
+			*(uint32_t *)rp = stamp[0];
 			rp += rs;
 		}
 	} else {

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.32 src/sys/dev/rasops/rasops24.c:1.33
--- src/sys/dev/rasops/rasops24.c:1.32	Wed Jul 24 18:33:49 2019
+++ src/sys/dev/rasops/rasops24.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.32 2019/07/24 18:33:49 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.33 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.32 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.33 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -272,9 +272,9 @@ rasops24_putchar8(void *cookie, int row,
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
-			rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+			rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] =
+			    stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	} else {
@@ -300,10 +300,8 @@ rasops24_putchar8(void *cookie, int row,
 
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
-		uint32_t c = STAMP_READ(52);
-
 		DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
-		rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = c;
+		rp[0] = rp[1] = rp[2] = rp[3] = rp[4] = rp[5] = STAMP_READ(52);
 	}
 
 	stamp_mutex--;
@@ -348,10 +346,9 @@ rasops24_putchar12(void *cookie, int row
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
 			rp[0] = rp[1] = rp[2] = rp[3] =
-			rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = c;
+			rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	} else {
@@ -382,11 +379,9 @@ rasops24_putchar12(void *cookie, int row
 
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
-		uint32_t c = STAMP_READ(52);
-
 		DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
 		rp[0] = rp[1] = rp[2] = rp[3] =
-		rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = c;
+		rp[4] = rp[5] = rp[6] = rp[7] = rp[8] = STAMP_READ(52);
 	}
 
 	stamp_mutex--;
@@ -431,11 +426,10 @@ rasops24_putchar16(void *cookie, int row
 	height = font->fontheight;
 
 	if (uc == (u_int)-1) {
-		uint32_t c = stamp[0];
 		while (height--) {
 			rp[0] = rp[1] = rp[2] = rp[3] =
 			rp[4] = rp[5] = rp[6] = rp[7] =
-			rp[8] = rp[9] = rp[10] = rp[11] = c;
+			rp[8] = rp[9] = rp[10] = rp[11] = stamp[0];
 			DELTA(rp, ri->ri_stride, uint32_t *);
 		}
 	} else {
@@ -471,12 +465,10 @@ rasops24_putchar16(void *cookie, int row
 
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
-		uint32_t c = STAMP_READ(52);
-
 		DELTA(rp, -(ri->ri_stride << 1), uint32_t *);
 		rp[0] = rp[1] = rp[2] = rp[3] =
 		rp[4] = rp[5] = rp[6] = rp[7] =
-		rp[8] = rp[9] = rp[10] = rp[11] = c;
+		rp[8] = rp[9] = rp[10] = rp[11] = STAMP_READ(52);
 	}
 
 	stamp_mutex--;

Index: src/sys/dev/rasops/rasops4.c
diff -u src/sys/dev/rasops/rasops4.c:1.15 src/sys/dev/rasops/rasops4.c:1.16
--- src/sys/dev/rasops/rasops4.c:1.15	Wed Jul 24 18:33:49 2019
+++ src/sys/dev/rasops/rasops4.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops4.c,v 1.15 2019/07/24 18:33:49 rin Exp $	*/
+/* 	$NetBSD: rasops4.c,v 1.16 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.15 2019/07/24 18:33:49 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.16 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -283,7 +283,8 @@ rasops4_putchar8(void *cookie, int row, 
 	}
 #endif
 
-	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+	    col * ri->ri_xscale);
 	height = font->fontheight;
 	rs = ri->ri_stride / sizeof(*rp);
 
@@ -292,10 +293,8 @@ rasops4_putchar8(void *cookie, int row, 
 		rasops4_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint16_t c = stamp[0];
 		while (height--) {
-			rp[0] = c;
-			rp[1] = c;
+			rp[0] = rp[1] = stamp[0];
 			rp += rs;
 		}
 	} else {
@@ -314,8 +313,7 @@ rasops4_putchar8(void *cookie, int row, 
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
 		rp -= (rs << 1);
-		rp[0] = stamp[15];
-		rp[1] = stamp[15];
+		rp[0] = rp[1] = stamp[15];
 	}
 
 	stamp_mutex--;
@@ -353,7 +351,8 @@ rasops4_putchar12(void *cookie, int row,
 	}
 #endif
 
-	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+	    col * ri->ri_xscale);
 	height = font->fontheight;
 	rs = ri->ri_stride / sizeof(*rp);
 
@@ -362,11 +361,8 @@ rasops4_putchar12(void *cookie, int row,
 		rasops4_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint16_t c = stamp[0];
 		while (height--) {
-			rp[0] = c;
-			rp[1] = c;
-			rp[2] = c;
+			rp[0] = rp[1] = rp[2] = stamp[0];
 			rp += rs;
 		}
 	} else {
@@ -386,9 +382,7 @@ rasops4_putchar12(void *cookie, int row,
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
 		rp -= (rs << 1);
-		rp[0] = stamp[15];
-		rp[1] = stamp[15];
-		rp[2] = stamp[15];
+		rp[0] = rp[1] = rp[2] = stamp[15];
 	}
 
 	stamp_mutex--;
@@ -426,7 +420,8 @@ rasops4_putchar16(void *cookie, int row,
 	}
 #endif
 
-	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
+	rp = (uint16_t *)(ri->ri_bits + row * ri->ri_yscale +
+	    col * ri->ri_xscale);
 	height = font->fontheight;
 	rs = ri->ri_stride / sizeof(*rp);
 
@@ -435,12 +430,8 @@ rasops4_putchar16(void *cookie, int row,
 		rasops4_makestamp(ri, attr);
 
 	if (uc == ' ') {
-		uint16_t c = stamp[0];
 		while (height--) {
-			rp[0] = c;
-			rp[1] = c;
-			rp[2] = c;
-			rp[3] = c;
+			rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
 			rp += rs;
 		}
 	} else {
@@ -461,10 +452,7 @@ rasops4_putchar16(void *cookie, int row,
 	/* Do underline */
 	if ((attr & WSATTR_UNDERLINE) != 0) {
 		rp -= (rs << 1);
-		rp[0] = stamp[15];
-		rp[1] = stamp[15];
-		rp[2] = stamp[15];
-		rp[3] = stamp[15];
+		rp[0] = rp[1] = rp[2] = rp[3] = stamp[15];
 	}
 
 	stamp_mutex--;
Index: src/sys/dev/rasops/rasops_bitops.h
diff -u src/sys/dev/rasops/rasops_bitops.h:1.15 src/sys/dev/rasops/rasops_bitops.h:1.16
--- src/sys/dev/rasops/rasops_bitops.h:1.15	Mon Dec  2 14:05:51 2013
+++ src/sys/dev/rasops/rasops_bitops.h	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops_bitops.h,v 1.15 2013/12/02 14:05:51 tsutsui Exp $	*/
+/* 	$NetBSD: rasops_bitops.h,v 1.16 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -143,7 +143,8 @@ NAME(do_cursor)(struct rasops_info *ri)
 	col = ri->ri_ccol * ri->ri_font->fontwidth << PIXEL_SHIFT;
 	height = ri->ri_font->fontheight;
 	num = ri->ri_font->fontwidth << PIXEL_SHIFT;
-	rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
+	rp = (uint32_t *)(ri->ri_bits + row * ri->ri_yscale +
+	    ((col >> 3) & ~3));
 	if (ri->ri_hwbits)
 		hrp = (uint32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
 		    ((col >> 3) & ~3));

Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.39 src/sys/dev/rasops/rasops8.c:1.40
--- src/sys/dev/rasops/rasops8.c:1.39	Thu Jul 25 01:07:32 2019
+++ src/sys/dev/rasops/rasops8.c	Thu Jul 25 02:26:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops8.c,v 1.39 2019/07/25 01:07:32 rin Exp $	*/
+/* 	$NetBSD: rasops8.c,v 1.40 2019/07/25 02:26:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.39 2019/07/25 01:07:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.40 2019/07/25 02:26:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -482,9 +482,12 @@ rasops8_putchar12(void *cookie, int row,
 			rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
 			rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
 			if (ri->ri_hwbits) {
-				hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
-				hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
-				hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
+				hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
+				    STAMP_MASK);
+				hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
+				    STAMP_MASK);
+				hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) &
+				    STAMP_MASK);
 			}
 
 			fr += fs;
@@ -572,10 +575,14 @@ rasops8_putchar16(void *cookie, int row,
 			rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
 			rp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
 			if (ri->ri_hwbits) {
-				hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
-				hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
-				hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
-				hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
+				hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
+				    STAMP_MASK);
+				hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
+				    STAMP_MASK);
+				hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) &
+				    STAMP_MASK);
+				hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) &
+				    STAMP_MASK);
 			}
 
 			fr += fs;

Reply via email to