This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch 3/4] decimal floating point support for expressions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]