X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/43487eff262637a59a4c2c0272d7c4a824af3944..3d33d9c0d1894c447324d8327200c212ddad3716:/lunaix-os/arch/generic/includes/asm-generic/bits.h diff --git a/lunaix-os/arch/generic/includes/asm-generic/bits.h b/lunaix-os/arch/generic/includes/asm-generic/bits.h index 430e395..e736f0d 100644 --- a/lunaix-os/arch/generic/includes/asm-generic/bits.h +++ b/lunaix-os/arch/generic/includes/asm-generic/bits.h @@ -2,12 +2,15 @@ #define __LUNAIX_ARCH_GENERIC_BITS_H #define _BITS_GENMASK(h, l) \ - (((1UL << ((h) + 1)) - 1) ^ ((1UL << (l)) - 1)) + (((1 << ((h) + 1)) - 1) ^ ((1 << (l)) - 1)) #define _BITS_EXTRACT(from, h, l) \ - (((from) & (((1UL << (h + 1)) - 1) ^ ((1UL << l) - 1))) >> l) + (((from) & (((1 << (h + 1)) - 1) ^ ((1 << (l)) - 1))) >> (l)) #define _BITS_INSERT(to, from, h, l) \ - (((to) & ~_BITS_GENMASK(h, l)) | (((from) << l) & _BITS_GENMASK(h, l))) + (((to) & ~_BITS_GENMASK(h, l)) | (((from) << (l)) & _BITS_GENMASK(h, l))) + +#define _BITS_STATIC(val, h, l) \ + (((val) & _BITS_GENMASK(h, l)) << (l)) #endif /* __LUNAIX_ARCH_BITS_H */