summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-05 07:20:26 +0000
committertron <tron@openttd.org>2005-10-05 07:20:26 +0000
commit39f5dbfd3b22f24120c63c09433415cdde023bc6 (patch)
tree8281c38dbbb38386dacf57d352e00b62be0edc77 /macros.h
parent6687d63add08a36f7366764fa2482270e8d7a80e (diff)
downloadopenttd-39f5dbfd3b22f24120c63c09433415cdde023bc6.tar.xz
(svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/macros.h b/macros.h
index 26c4d9985..0918d44e5 100644
--- a/macros.h
+++ b/macros.h
@@ -145,11 +145,11 @@ static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a
#endif
/// Fetch n bits starting at bit s from x
-#define GB(x, s, n) (((x) >> (s)) & ((1 << (n)) - 1))
+#define GB(x, s, n) (((x) >> (s)) & ((1U << (n)) - 1))
/// Set n bits starting at bit s in x to d
-#define SB(x, s, n, d) ((x) = ((x) & ~(((1 << (n)) - 1) << (s))) | ((d) << (s)))
+#define SB(x, s, n, d) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | ((d) << (s)))
/// Add i to the n bits starting at bit s in x
-#define AB(x, s, n, i) ((x) = ((x) & ~(((1 << (n)) - 1) << (s))) | (((x) + ((i) << (s))) & (((1 << (n)) - 1) << (s))))
+#define AB(x, s, n, i) ((x) = ((x) & ~(((1U << (n)) - 1) << (s))) | (((x) + ((i) << (s))) & (((1U << (n)) - 1) << (s))))
/**
* ROtate x Left/Right by n (must be >= 0)