summaryrefslogtreecommitdiff
path: root/gcc/fixed-value.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-07 09:23:32 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-09-07 09:23:32 +0000
commit796b6678b7a5be26e44d64a3b299ac5a8f0877e2 (patch)
tree4e81b82b3b3a04b8f3a48aa7c3dc3d336f8a185c /gcc/fixed-value.c
parente02d19d4264184dbf4aec0a7f1a31db9a6471ff4 (diff)
downloadgcc-796b6678b7a5be26e44d64a3b299ac5a8f0877e2.tar.gz
Reorganise wide-int classes so that they are all instantiations of a
generic_wide_int class, parameterised by storage. Move all real work outside the main wide_int classes into separate functions. Add a wi:: namespace. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@202354 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fixed-value.c')
-rw-r--r--gcc/fixed-value.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/fixed-value.c b/gcc/fixed-value.c
index 65a5deb454d..98689e91dad 100644
--- a/gcc/fixed-value.c
+++ b/gcc/fixed-value.c
@@ -157,11 +157,12 @@ fixed_to_decimal (char *str, const FIXED_VALUE_TYPE *f_orig,
{
REAL_VALUE_TYPE real_value, base_value, fixed_value;
+ signop sgn = UNSIGNED_FIXED_POINT_MODE_P (f_orig->mode) ? UNSIGNED : SIGNED;
real_2expN (&base_value, GET_MODE_FBIT (f_orig->mode), f_orig->mode);
real_from_integer (&real_value, VOIDmode,
- wide_int::from_double_int (f_orig->data,
- GET_MODE_PRECISION (f_orig->mode)),
- UNSIGNED_FIXED_POINT_MODE_P (f_orig->mode) ? UNSIGNED : SIGNED);
+ wide_int::from (f_orig->data,
+ GET_MODE_PRECISION (f_orig->mode), sgn),
+ sgn);
real_arithmetic (&fixed_value, RDIV_EXPR, &real_value, &base_value);
real_to_decimal (str, &fixed_value, buf_size, 0, 1);
}
@@ -1102,11 +1103,11 @@ real_convert_from_fixed (REAL_VALUE_TYPE *r, enum machine_mode mode,
{
REAL_VALUE_TYPE base_value, fixed_value, real_value;
+ signop sgn = UNSIGNED_FIXED_POINT_MODE_P (f->mode) ? UNSIGNED : SIGNED;
real_2expN (&base_value, GET_MODE_FBIT (f->mode), f->mode);
real_from_integer (&fixed_value, VOIDmode,
- wide_int::from_double_int (f->data,
- GET_MODE_PRECISION (f->mode)),
- UNSIGNED_FIXED_POINT_MODE_P (f->mode) ? UNSIGNED : SIGNED);
+ wide_int::from (f->data, GET_MODE_PRECISION (f->mode),
+ sgn), sgn);
real_arithmetic (&real_value, RDIV_EXPR, &fixed_value, &base_value);
real_convert (r, mode, &real_value);
}