add basic exception model and context switching for aarch64
[lunaix-os.git] / lunaix-os / includes / lunaix / bits.h
1 #ifndef __LUNAIX_BITS_H
2 #define __LUNAIX_BITS_H
3
4 #include <lunaix/compiler.h>
5
6 #define BITS(h, l)               (((1UL << ((h) + 1)) - 1) ^ ((1UL << (l)) - 1))
7 #define BIT(p)                   BITS(p, p)
8
9 #define BITS_GET(from, bits)     (((from) & (bits)) >> ctzl(bits))
10
11 #define BITS_SET(to, bits, val)  \
12             (((to) & ~(bits)) | (((val) << ctzl(bits)) & (bits)))
13
14 #endif /* __LUNAIX_BITS_H */