bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

snan: Add support for m68k


From: Bruno Haible
Subject: snan: Add support for m68k
Date: Fri, 19 Apr 2024 02:13:58 +0200

On m68k, our 'snan' module actually return quiet, not signalling, 'long double'
NaNs. This patch fixes it.


2024-04-18  Bruno Haible  <bruno@clisp.org>

        snan: Add support for m68k.
        * lib/snan.h (construct_memory_SNaNl): Handle m68k specially.

diff --git a/lib/snan.h b/lib/snan.h
index c7312e259f..caee37b515 100644
--- a/lib/snan.h
+++ b/lib/snan.h
@@ -230,6 +230,11 @@ construct_memory_SNaNl (long double quiet_value)
     m.word[LDBL_EXPBIT0_WORD + (LDBL_EXPBIT0_WORD < HNWORDS / 2 ? 1 : - 1)]
       ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 2);
    #endif
+  #elif (defined __m68k__ && LDBL_MANT_DIG == 64) && 
!HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
+  /* In this representation, there is a 16-bits gap between the exponent and
+     the mantissa, and the leading 1 of the mantissa is explicitly stored.  */
+    m.word[LDBL_EXPBIT0_WORD + 1]
+      ^= (unsigned int) 1 << (sizeof (unsigned int) * CHAR_BIT - 2);
   #else
   /* In this representation, the leading 1 of the mantissa is implicit.  */
    #if LDBL_EXPBIT0_BIT > 0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]