Source-Changes-HG archive

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

[src/trunk]: src/games/battlestar avoid signed left-shift



details:   https://anonhg.NetBSD.org/src/rev/f27bed6a78c2
branches:  trunk
changeset: 327986:f27bed6a78c2
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 23:23:55 2014 +0000

description:
avoid signed left-shift

diffstat:

 games/battlestar/extern.h |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r 886f5bbc1709 -r f27bed6a78c2 games/battlestar/extern.h
--- a/games/battlestar/extern.h Sat Mar 22 23:16:21 2014 +0000
+++ b/games/battlestar/extern.h Sat Mar 22 23:23:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.34 2014/03/22 23:16:21 dholland Exp $ */
+/*     $NetBSD: extern.h,v 1.35 2014/03/22 23:23:55 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -42,14 +42,14 @@
 #include <time.h>
 #include <unistd.h>
 
-#define BITS (CHAR_BIT * sizeof (int))
+#define BITS (CHAR_BIT * sizeof (unsigned int))
 
 #define OUTSIDE                (position > 68 && position < 246 && position != 218)
 #define rnd(x)         (rand() % (x))
 #define max(a,b)       ((a) < (b) ? (b) : (a))
-#define testbit(array, index)  (array[index/BITS] & (1 << (index % BITS)))
-#define setbit(array, index)   (array[index/BITS] |= (1 << (index % BITS)))
-#define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS)))
+#define testbit(array, index)  (array[index/BITS] & (1U << (index % BITS)))
+#define setbit(array, index)   (array[index/BITS] |= (1U << (index % BITS)))
+#define clearbit(array, index) (array[index/BITS] &= ~(1U << (index % BITS)))
 
  /* well known rooms */
 #define FINAL  275



Home | Main Index | Thread Index | Old Index