This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 3/4] decimal floating point support for expressions
- From: Daniel Jacobowitz <drow at false dot org>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 11 Oct 2007 12:16:45 -0400
- Subject: Re: [patch 3/4] decimal floating point support for expressions
- References: <20070920215410.062714003@br.ibm.com> <20070920215539.891263549@br.ibm.com>
On Thu, Sep 20, 2007 at 06:54:13PM -0300, Thiago Jung Bauermann wrote:
> + putithere->typed_val_decfloat.type =
> + builtin_type (current_gdbarch)->builtin_decfloat;
Equals sign on next line please.
> @@ -1376,6 +1376,20 @@ value_neg (struct value *arg1)
>
> type = check_typedef (value_type (arg1));
>
> + if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
> + {
> + struct value *val = allocate_value (result_type);
> + int len = TYPE_LENGTH (type);
> + gdb_byte *decbytes = (gdb_byte *) value_contents (arg1);
> +
> + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
> + decbytes[len-1] = decbytes[len - 1] | 0x80;
> + else
> + decbytes[0] = decbytes[0] | 0x80;
> + memcpy (value_contents_raw (val), decbytes, 16);
> + return val;
> + }
> +
The reason we allocate a new value is to leave the existing value
unchanged, so you shouldn't modify the contents of arg1. The casts
are probably there because otherwise GCC complained you were removing
a const. Don't do that :-)
> +#include "dfp.h"
If you add an #include, update Makefile.in.
--
Daniel Jacobowitz
CodeSourcery