From 289bd67a5d1337355072d94f2552389066c2a9db Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 3 Jun 2009 17:47:54 +0000 Subject: * dfp.h (decimal_binop): Convert LEN_RESULT to input parameter. * dfp.c (promote_decimal): Remove. (decimal_binop): Convert LEN_RESULT to input parameter. Remove call to decimal_binop. (decimal_compare): Remove call to decimal_binop. * valarith.c (value_binop): Pass desired result type length to decimal_binop. --- gdb/valarith.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'gdb/valarith.c') diff --git a/gdb/valarith.c b/gdb/valarith.c index f38cdb8..57e6194 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -887,6 +887,19 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) gdb_byte v1[16], v2[16]; gdb_byte v[16]; + /* If only one type is decimal float, use its type. + Otherwise use the bigger type. */ + if (TYPE_CODE (type1) != TYPE_CODE_DECFLOAT) + result_type = type2; + else if (TYPE_CODE (type2) != TYPE_CODE_DECFLOAT) + result_type = type1; + else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1)) + result_type = type2; + else + result_type = type1; + + len_v = TYPE_LENGTH (result_type); + value_args_as_decimal (arg1, arg2, v1, &len_v1, v2, &len_v2); switch (op) @@ -896,24 +909,13 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) case BINOP_MUL: case BINOP_DIV: case BINOP_EXP: - decimal_binop (op, v1, len_v1, v2, len_v2, v, &len_v); + decimal_binop (op, v1, len_v1, v2, len_v2, v, len_v); break; default: error (_("Operation not valid for decimal floating point number.")); } - /* If only one type is decimal float, use its type. - Otherwise use the bigger type. */ - if (TYPE_CODE (type1) != TYPE_CODE_DECFLOAT) - result_type = type2; - else if (TYPE_CODE (type2) != TYPE_CODE_DECFLOAT) - result_type = type1; - else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1)) - result_type = type2; - else - result_type = type1; - val = value_from_decfloat (result_type, v); } else if (TYPE_CODE (type1) == TYPE_CODE_FLT -- cgit v1.1