macros: add macro to specify a bit mask range

This commit is contained in:
S.J.R. van Schaik 2017-07-18 12:58:30 +02:00
parent 159a4e83b4
commit 7d0dcfaae5

View file

@ -30,3 +30,4 @@
/* Bit manipulation */
#define BIT_SIZE(t) (CHAR_BIT * sizeof(t))
#define BIT(n) (1 << (n))
#define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end))