summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-05-11 10:33:58 +0000
committercelestar <celestar@openttd.org>2006-05-11 10:33:58 +0000
commit48d991b8197db61c41ac35b3b08be85344612ba5 (patch)
tree95ea258355086eae6b3df6fc5bd9bee882e5a293 /macros.h
parent151e79231d564cc66b381a50d4cb3116719499de (diff)
downloadopenttd-48d991b8197db61c41ac35b3b08be85344612ba5.tar.xz
(svn r4822) -Feature: Station List View can now be sorted and filtered (by waiting cargo type and facilities)
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 4f9fa192d..ff0fe8936 100644
--- a/macros.h
+++ b/macros.h
@@ -117,6 +117,9 @@ static inline int KillFirstBit2x64(int value)
}
}
+/** returns true if value a has only one bit set to 1 */
+#define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0)
+
/* [min,max), strictly less than */
#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))
#define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))