Lines Matching refs:_mask

63 #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx)			\
65 BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
67 BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
69 ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
71 BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
74 __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
75 (1ULL << __bf_shf(_mask))); \
80 * @_mask: shifted mask defining the field's length and position
83 * specified by @_mask.
85 #define FIELD_MAX(_mask) \
87 __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_MAX: "); \
88 (typeof(_mask))((_mask) >> __bf_shf(_mask)); \
93 * @_mask: shifted mask defining the field's length and position
96 * Return: true if @_val can fit inside @_mask, false if @_val is too big.
98 #define FIELD_FIT(_mask, _val) \
100 __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_FIT: "); \
101 !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \
106 * @_mask: shifted mask defining the field's length and position
112 #define FIELD_PREP(_mask, _val) \
114 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
115 ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
122 * @_mask: shifted mask defining the field's length and position
132 #define FIELD_PREP_CONST(_mask, _val) \
135 BUILD_BUG_ON_ZERO((_mask) == 0) + \
137 BUILD_BUG_ON_ZERO(~((_mask) >> __bf_shf(_mask)) & (_val)) + \
139 __BF_CHECK_POW2((_mask) + (1ULL << __bf_shf(_mask))) + \
141 (((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask)) \
146 * @_mask: shifted mask defining the field's length and position
149 * FIELD_GET() extracts the field specified by @_mask from the
152 #define FIELD_GET(_mask, _reg) \
154 __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
155 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \