Lines Matching full:field
51 _pfx "value too large for the field"); \
59 * FIELD_MAX() - produce the maximum value representable by a field
60 * @_mask: shifted mask defining the field's length and position
62 * FIELD_MAX() returns the maximum value that can be held in the field
72 * FIELD_FIT() - check if value fits in the field
73 * @_mask: shifted mask defining the field's length and position
74 * @_val: value to test against the field
86 * @_mask: shifted mask defining the field's length and position
87 * @_val: value to put in the field
100 * @_mask: shifted mask defining the field's length and position
103 * FIELD_GET() extracts the field specified by @_mask from the
116 static __always_inline u64 field_multiplier(u64 field) in field_multiplier() argument
118 if ((field | (field - 1)) & ((field | (field - 1)) + 1)) in field_multiplier()
120 return field & -field; in field_multiplier()
122 static __always_inline u64 field_mask(u64 field) in field_mask() argument
124 return field / field_multiplier(field); in field_mask()
126 #define field_max(field) ((typeof(field))field_mask(field)) argument
128 static __always_inline __##type type##_encode_bits(base v, base field) \
130 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
132 return to((v & field_mask(field)) * field_multiplier(field)); \
135 base val, base field) \
137 return (old & ~to(field)) | type##_encode_bits(val, field); \
140 base val, base field) \
142 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
144 static __always_inline base type##_get_bits(__##type v, base field) \
146 return (from(v) & field)/field_multiplier(field); \