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 integers for bit sets
details: https://anonhg.NetBSD.org/src/rev/58723ba1d995
branches: trunk
changeset: 366516:58723ba1d995
user: rillig <rillig%NetBSD.org@localhost>
date: Sun May 29 15:16:11 2022 +0000
description:
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.
diffstat:
games/gomoku/pickmove.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (40 lines):
diff -r 81b37a19a6ec -r 58723ba1d995 games/gomoku/pickmove.c
--- a/games/gomoku/pickmove.c Sun May 29 14:50:37 2022 +0000
+++ b/games/gomoku/pickmove.c Sun May 29 15:16:11 2022 +0000
@@ -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 @@
#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 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);
Home |
Main Index |
Thread Index |
Old Index