Lines Matching refs:field
133 static __always_inline u64 field_multiplier(u64 field) in field_multiplier() argument
135 if ((field | (field - 1)) & ((field | (field - 1)) + 1)) in field_multiplier()
137 return field & -field; in field_multiplier()
139 static __always_inline u64 field_mask(u64 field) in field_mask() argument
141 return field / field_multiplier(field); in field_mask()
143 #define field_max(field) ((typeof(field))field_mask(field)) argument
145 static __always_inline __##type type##_encode_bits(base v, base field) \
147 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
149 return to((v & field_mask(field)) * field_multiplier(field)); \
152 base val, base field) \
154 return (old & ~to(field)) | type##_encode_bits(val, field); \
157 base val, base field) \
159 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
161 static __always_inline base type##_get_bits(__##type v, base field) \
163 return (from(v) & field)/field_multiplier(field); \