Source-Changes-HG archive

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

[src/trunk]: src/games/gomoku gomoku: use unsigned arithmetic for bitboard



details:   https://anonhg.NetBSD.org/src/rev/85fa5adbd0c9
branches:  trunk
changeset: 366479:85fa5adbd0c9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 28 21:48:21 2022 +0000

description:
gomoku: use unsigned arithmetic for bitboard

No functional change.

diffstat:

 games/gomoku/pickmove.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (30 lines):

diff -r 96c6774b3423 -r 85fa5adbd0c9 games/gomoku/pickmove.c
--- a/games/gomoku/pickmove.c   Sat May 28 21:31:41 2022 +0000
+++ b/games/gomoku/pickmove.c   Sat May 28 21:48:21 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pickmove.c,v 1.47 2022/05/28 08:19:18 rillig Exp $     */
+/*     $NetBSD: pickmove.c,v 1.48 2022/05/28 21:48:21 rillig Exp $     */
 
 /*
  * Copyright (c) 1994
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 /*     @(#)pickmove.c  8.2 (Berkeley) 5/3/95   */
-__RCSID("$NetBSD: pickmove.c,v 1.47 2022/05/28 08:19:18 rillig Exp $");
+__RCSID("$NetBSD: pickmove.c,v 1.48 2022/05/28 21:48:21 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -46,9 +46,8 @@
 #define BITS_PER_INT   (sizeof(int) * CHAR_BIT)
 #define MAPSZ          (BAREA / BITS_PER_INT)
 
-#define BIT_SET(a, b)  ((a)[(b)/BITS_PER_INT] |= (1 << ((b) % BITS_PER_INT)))
-#define BIT_CLR(a, b)  ((a)[(b)/BITS_PER_INT] &= ~(1 << ((b) % BITS_PER_INT)))
-#define BIT_TEST(a, b) (((a)[(b)/BITS_PER_INT] & (1 << ((b) % BITS_PER_INT))) != 0)
+#define BIT_SET(a, b)  ((a)[(unsigned int)(b)/BITS_PER_INT] |= (1 << ((unsigned int)(b) % BITS_PER_INT)))
+#define BIT_TEST(a, b) (((a)[(unsigned int)(b)/BITS_PER_INT] & (1 << ((unsigned int)(b) % BITS_PER_INT))) != 0)
 
 /*
  * This structure is used to store overlap information between frames.



Home | Main Index | Thread Index | Old Index