Lines Matching refs:field

71 				 _pfx "value too large for the field"); \
80 * FIELD_MAX() - produce the maximum value representable by a field
81 * @_mask: shifted mask defining the field's length and position
83 * FIELD_MAX() returns the maximum value that can be held in the field
93 * FIELD_FIT() - check if value fits in the field
94 * @_mask: shifted mask defining the field's length and position
95 * @_val: value to test against the field
107 * @_mask: shifted mask defining the field's length and position
108 * @_val: value to put in the field
123 * @_mask: shifted mask defining the field's length and position
124 * @_val: value to put in the field
147 * @_mask: shifted mask defining the field's length and position
150 * FIELD_GET() extracts the field specified by @_mask from the
163 static __always_inline u64 field_multiplier(u64 field)
165 if ((field | (field - 1)) & ((field | (field - 1)) + 1))
167 return field & -field;
169 static __always_inline u64 field_mask(u64 field)
171 return field / field_multiplier(field);
173 #define field_max(field) ((typeof(field))field_mask(field))
175 static __always_inline __##type type##_encode_bits(base v, base field) \
177 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
179 return to((v & field_mask(field)) * field_multiplier(field)); \
182 base val, base field) \
184 return (old & ~to(field)) | type##_encode_bits(val, field); \
187 base val, base field) \
189 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
191 static __always_inline base type##_get_bits(__##type v, base field) \
193 return (from(v) & field)/field_multiplier(field); \