RFA fix conversion of little-byte big-word floats to doublest
Sun Dec 5 01:51:00 GMT 2004
On Sat, 04 Dec 2004 12:32:57 EST, Daniel Jacobowitz <email@example.com>
> On Sat, Dec 04, 2004 at 05:25:21PM +0000, Richard Earnshaw wrote:
> > I've just been thinking.
> > The current code (for both conversions to and from doublest) tries to work
> > by normalizing the word order to match the byte order. This clearly makes
> > things quite difficult when the number of words involved is variable.
> > I think it would be a more tractable problem to change all this around so
> > that the byte order is normalized to match the word order. This can be
> > done by simply repeating a word-normalization step for each word in the
> > value.
> > Thoughts?
> That sounds good to me - much simpler.
I withdraw my previous patch and substitute this one. This should also
fix handling of mixed endian formats that are larger than 64 bits.
Unlike the previous patch this one also correctly handles NaNs; though it
appears that nothing in the testsuite currently tests this.
* doublest.c (FLOATFORMAT_LARGEST_BYTES): New define.
(get_field, put_field): Assert that the format is one we can handle.
Simplify logic accordingly.
(floatformat_normalize_byteorder): New function.
(convert_floatformat_to_doublest): Use floatformat_normalize_byteorder to
normalize and select modified byte order. Pass modified byte order to
(floatformat_is_negative, floatformat_is_nan, floatformat_mantissa):
(convert_doublest_to_floatformat): Select an appropriate intermediate
byte order if necessary. Always convert to the final format before
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17940 bytes
More information about the Gdb-patches