aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2020-11-23 21:49:13 -0500
committerJoel Brobecker <brobecker@adacore.com>2020-11-23 21:49:13 -0500
commite6fcee3a73ddab55e3b35b7705b01035383e5417 (patch)
tree38ef476f6ba4c32b607fefa0b189cca54ff667a3 /gdb/valops.c
parentd19937a74c51872e8bbff6e37d9b89b202519b07 (diff)
downloadgdb-e6fcee3a73ddab55e3b35b7705b01035383e5417.zip
gdb-e6fcee3a73ddab55e3b35b7705b01035383e5417.tar.gz
gdb-e6fcee3a73ddab55e3b35b7705b01035383e5417.tar.bz2
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) <fixed_point_scaling_factor>: 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.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c6
1 files changed, 3 insertions, 3 deletions
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),