[RFC][02/19] Target FP: Simplify floatformat_from_type

Ulrich Weigand uweigand@de.ibm.com
Mon Sep 18 11:49:00 GMT 2017


Simon Marchi wrote:

> On 2017-09-05 20:20, Ulrich Weigand wrote:
> >    size_t len = bit / TARGET_CHAR_BIT;
> > -  gdb_assert (len >= floatformat_totalsize_bytes (floatformats[0]));
> > -  gdb_assert (len >= floatformat_totalsize_bytes (floatformats[1]));
> > +  gdb_assert (len * TARGET_CHAR_BIT >= floatformat->totalsize);
> 
> That looks funny now.  Is there a reason not to do
> 
>    gdb_assert (bit >= floatformat->totalsize);
> 
> directly?

Well, that would use different rounding ...   Of course, this only
matters when floatformat->totalsize is not a multiple of TARGET_CHAR_BIT,
which doesn't happen for any of the floatformats GDB supports, so it
is probably moot.  Maybe we should instead use an assert to verify that
floatformat->totalsize is in fact a multiple of TARGET_CHAR_BIT?

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list