summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 81eae88cb..eb11b8a5c 100644
--- a/macros.h
+++ b/macros.h
@@ -151,4 +151,9 @@ static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a
}
#endif
+// Fetch count bits starting at bit start from value
+#define GB(value, start, count) (((value) >> (start)) & ((1 << (count)) - 1))
+// Set count bits in value starting at bit start to data
+#define SB(value, start, count, data) ((value) = ((value) & ~(((1 << (count)) - 1) << (start))) | ((data) << (start)))
+
#endif /* MACROS_H */