From bc17fee1bfdbd330f5a4377bf40f6de0681afa5c Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Fri, 25 Mar 2022 19:51:35 +0100 Subject: Filter: Bitfield eattrs reading / writing moved to filter code Before this change, fetch-update-write and bitmasking was hardcoded in attribute access code cased by the attribute type. Several filter instructions are used to do it instead. As this is certainly going to be a little bit slower than before, the switch block in attribute access code should be completely removed in near future, helping with both performance and code cleanliness. The user interface should have stayed intact. --- filter/f-inst.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'filter/f-inst.h') diff --git a/filter/f-inst.h b/filter/f-inst.h index df45f88e..9265ecec 100644 --- a/filter/f-inst.h +++ b/filter/f-inst.h @@ -89,8 +89,8 @@ void f_add_lines(const struct f_line_item *what, struct filter_iterator *fit); struct filter *f_new_where(struct f_inst *); static inline struct f_dynamic_attr f_new_dynamic_attr(u8 type, enum f_type f_type, uint code) /* Type as core knows it, type as filters know it, and code of dynamic attribute */ { return (struct f_dynamic_attr) { .type = type, .f_type = f_type, .ea_code = code }; } /* f_type currently unused; will be handy for static type checking */ -static inline struct f_dynamic_attr f_new_dynamic_attr_bit(u8 bit, enum f_type f_type, uint code) /* Type as core knows it, type as filters know it, and code of dynamic attribute */ -{ return (struct f_dynamic_attr) { .type = EAF_TYPE_BITFIELD, .bit = bit, .f_type = f_type, .ea_code = code }; } /* f_type currently unused; will be handy for static type checking */ +static inline struct f_dynamic_attr f_new_dynamic_attr_bit(u8 bit, uint code) /* Type as core knows it, type as filters know it, and code of dynamic attribute */ +{ return (struct f_dynamic_attr) { .type = EAF_TYPE_INT, .bit = bit, .f_type = T_INT, .ea_code = code }; } /* f_type currently unused; will be handy for static type checking */ static inline struct f_static_attr f_new_static_attr(int f_type, int code, int readonly) { return (struct f_static_attr) { .f_type = f_type, .sa_code = code, .readonly = readonly }; } struct f_inst *f_generate_complex(enum f_instruction_code fi_code, struct f_dynamic_attr da, struct f_inst *argument); -- cgit v1.2.3