Message ID | 1461340713-9587-2-git-send-email-julien.grall@arm.com |
---|---|
State | New |
Headers | show |
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index cb56f24..bd0883a 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -3,6 +3,14 @@ #include <asm/types.h> /* + * Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000. + */ +#define GENMASK(h, l) \ + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) + +/* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore * differs in spirit from the above ffz (man ffs).