(svn r3019) -Codechange: Replace explicit shifting/anding/oring with GB and SB

This commit is contained in:
tron
2005-10-05 07:20:26 +00:00
parent 102cf2615f
commit ae4a1f3675
17 changed files with 126 additions and 127 deletions

View File

@@ -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)