From e6fcee3a73ddab55e3b35b7705b01035383e5417 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Mon, 23 Nov 2020 21:49:13 -0500 Subject: Make function fixed_point_scaling_factor a method of struct type This logically connects this function to the object it inspects. gdb/ChangeLog: * gdbtypes.h (struct type) : New method, replacing fixed_point_scaling_factor. All callers updated throughout this project. (fixed_point_scaling_factor): Delete declaration. * gdbtypes.c (type::fixed_point_scaling_factor): Replaces fixed_point_scaling_factor. Adjust implementation accordingly. --- gdb/valops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/valops.c') diff --git a/gdb/valops.c b/gdb/valops.c index 3e2d5d3..4d0e002 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -363,7 +363,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val) mpq_set_z (vq.val, vz.val); if (is_fixed_point_type (from_type)) - mpq_mul (vq.val, vq.val, fixed_point_scaling_factor (from_type).val); + mpq_mul (vq.val, vq.val, from_type->fixed_point_scaling_factor ().val); } else @@ -373,7 +373,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val) /* Divide that value by the scaling factor to obtain the unscaled value, first in rational form, and then in integer form. */ - mpq_div (vq.val, vq.val, fixed_point_scaling_factor (to_type).val); + mpq_div (vq.val, vq.val, to_type->fixed_point_scaling_factor ().val); gdb_mpz unscaled = vq.get_rounded (); /* Finally, create the result value, and pack the unscaled value @@ -527,7 +527,7 @@ value_cast (struct type *type, struct value *arg2) fp_val.read_fixed_point (gdb::make_array_view (value_contents (arg2), TYPE_LENGTH (type2)), type_byte_order (type2), type2->is_unsigned (), - fixed_point_scaling_factor (type2)); + type2->fixed_point_scaling_factor ()); struct value *v = allocate_value (to_type); target_float_from_host_double (value_contents_raw (v), -- cgit v1.1