Module Name: src Committed By: rillig Date: Sun May 29 15:16:11 UTC 2022
Modified Files: src/games/gomoku: pickmove.c Log Message: gomoku: use unsigned integers for bit sets As all access to the bit sets happens through the unsigned spot_index type, drop the type casts in the macros. No functional change on 2s complement machines. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/games/gomoku/pickmove.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/gomoku/pickmove.c diff -u src/games/gomoku/pickmove.c:1.59 src/games/gomoku/pickmove.c:1.60 --- src/games/gomoku/pickmove.c:1.59 Sun May 29 14:37:44 2022 +++ src/games/gomoku/pickmove.c Sun May 29 15:16:11 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pickmove.c,v 1.59 2022/05/29 14:37:44 rillig Exp $ */ +/* $NetBSD: pickmove.c,v 1.60 2022/05/29 15:16:11 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.59 2022/05/29 14:37:44 rillig Exp $"); +__RCSID("$NetBSD: pickmove.c,v 1.60 2022/05/29 15:16:11 rillig Exp $"); #include <stdlib.h> #include <string.h> @@ -46,8 +46,8 @@ __RCSID("$NetBSD: pickmove.c,v 1.59 2022 #define BITS_PER_INT (sizeof(int) * CHAR_BIT) #define MAPSZ (BAREA / BITS_PER_INT) -#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) +#define BIT_SET(a, b) ((a)[(b)/BITS_PER_INT] |= (1U << ((b) % BITS_PER_INT))) +#define BIT_TEST(a, b) (((a)[(b)/BITS_PER_INT] & (1U << ((b) % BITS_PER_INT))) != 0) /* * This structure is used to store overlap information between frames. @@ -64,8 +64,8 @@ static int combolen; /* number of comb static int nextcolor; /* color of next move */ static int elistcnt; /* count of struct elist allocated */ static int combocnt; /* count of struct combostr allocated */ -static int forcemap[MAPSZ]; /* map for blocking <1,x> combos */ -static int tmpmap[MAPSZ]; /* map for blocking <1,x> combos */ +static unsigned int forcemap[MAPSZ]; /* map for blocking <1,x> combos */ +static unsigned int tmpmap[MAPSZ]; /* map for blocking <1,x> combos */ static int nforce; /* count of opponent <1,x> combos */ static bool better(spot_index, spot_index, int);