summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-03 19:42:09 +0000
committertron <tron@openttd.org>2006-03-03 19:42:09 +0000
commit40fd4377b0d2dbd7b6d3d0d3aa792fa7b1ec3984 (patch)
tree33b8df8ca1efa38a8227dd2ec34da277aed9c554 /macros.h
parent5b0e6f90a9a18ed549ebb70a1e1af35ef76361ef (diff)
downloadopenttd-40fd4377b0d2dbd7b6d3d0d3aa792fa7b1ec3984.tar.xz
(svn r3747) Change HASBIT() to return 0/1 instead of 0/value of tested bit, because the name suggests it does the former and current behavior broke in some places in very subtle ways (for example HASBIT(x, 0) != HASBIT(y, 1) doesn't work, returning a bool after HASBIT(x, 9) neither)
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/macros.h b/macros.h
index 75a365d63..7371d13fa 100644
--- a/macros.h
+++ b/macros.h
@@ -57,7 +57,7 @@ static inline int64 BIGMULS(int32 a, int32 b) {
#define IS_INSIDE_1D(x, base, size) ( (uint)((x) - (base)) < ((uint)(size)) )
-#define HASBIT(x,y) ((x) & (1 << (y)))
+#define HASBIT(x,y) (((x) & (1 << (y))) != 0)
#define SETBIT(x,y) ((x) |= (1 << (y)))
#define CLRBIT(x,y) ((x) &= ~(1 << (y)))
#define TOGGLEBIT(x,y) ((x) ^= (1 << (y)))