/* * Create a contiguous bitmask starting at bit position @l and ending at * position @h. For example * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
*/ #if !defined(__ASSEMBLY__)
/* * Missing asm support * * GENMASK_U*() and BIT_U*() depend on BITS_PER_TYPE() which relies on sizeof(), * something not available in asm. Nevertheless, fixed width integers is a C * concept. Assembly code can rely on the long and long long versions instead.
*/
/* * Generate a mask for the specified type @t. Additional checks are made to * guarantee the value returned fits in that type, relying on * -Wshift-count-overflow compiler check to detect incompatible arguments. * For example, all these create build errors or warnings: * * - GENMASK(15, 20): wrong argument order * - GENMASK(72, 15): doesn't fit unsigned long * - GENMASK_U32(33, 15): doesn't fit in a u32
*/ #define GENMASK_TYPE(t, h, l) \
((t)(GENMASK_INPUT_CHECK(h, l) + \
(type_max(t) << (l) & \
type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
/* * BUILD_BUG_ON_ZERO is not available in h files included from asm files, * disable the input check if that is the case.
*/ #define GENMASK(h, l) __GENMASK(h, l) #define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.