aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-06-03 17:47:54 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-06-03 17:47:54 +0000
commit289bd67a5d1337355072d94f2552389066c2a9db (patch)
tree31cd135bdad3152b185ee0ce381a2d8653c849c1 /gdb/valarith.c
parenta951221dcc4e433c832e328a7de4c4bc218a6ccd (diff)
downloadgdb-289bd67a5d1337355072d94f2552389066c2a9db.zip
gdb-289bd67a5d1337355072d94f2552389066c2a9db.tar.gz
gdb-289bd67a5d1337355072d94f2552389066c2a9db.tar.bz2
* 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.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c26
1 files changed, 14 insertions, 12 deletions
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