[PATCH v2 07/17] stdio-common: Add scanf long double data for Intel/Motorola 80-bit format

Andreas Schwab schwab@linux-m68k.org
Wed Mar 5 05:15:33 GMT 2025


On Mär 04 2025, Joseph Myers wrote:

> On Sat, 1 Mar 2025, Maciej W. Rozycki wrote:
>
>> +#undef compare_real
>> +#define compare_real(x, y)						\
>> +({									\
>> +  union									\
>> +    {									\
>> +      type_t v;								\
>> +      uint32_t i[3];							\
>> +    }									\
>> +  ux = { .v = x }, uy = { .v = y };					\
>> +  static_assert (sizeof (ux.v) == sizeof (ux.i), "type_t size check");	\
>> +  (ux.i[0] == uy.i[0] && ux.i[1] == uy.i[1]				\
>> +   && (ux.i[2] & 0xffff) == (uy.i[2] & 0xffff));		 	\
>
> I don't think this is correct for the big-endian (m68k) case, where the 
> sign and exponent are at the start (big end) of the first word, not the 
> little end of the last word.

We already have ieee_long_double_shape_type, just use it.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Libc-alpha mailing list