1 #ifndef __LUNAIX_BITS_H
2 #define __LUNAIX_BITS_H
4 #include <lunaix/compiler.h>
6 #define BITS(h, l) (((1UL << ((h) + 1)) - 1) ^ ((1UL << (l)) - 1))
7 #define BIT(p) BITS(p, p)
9 #define BITS_GET(from, bits) (((from) & (bits)) >> ctzl(bits))
11 #define BITS_SET(to, bits, val) \
12 (((to) & ~(bits)) | (((val) << ctzl(bits)) & (bits)))
14 #endif /* __LUNAIX_BITS_H */