summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-12-10 18:27:23 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2015-12-14 06:38:34 -0500
commit1f02ab1d906235f4e471be89230a7ddc630298a8 (patch)
tree0a3347f2ab09340f8a902c8817dafb3da8c05758 /perl.h
parent74c6ce8743ba719b8416ce00933e19104484b949 (diff)
downloadperl-1f02ab1d906235f4e471be89230a7ddc630298a8.tar.gz
infnan: NaN payload for mixed endian double-doubles
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h57
1 files changed, 44 insertions, 13 deletions
diff --git a/perl.h b/perl.h
index 727e6bea0b..960a8a5cdc 100644
--- a/perl.h
+++ b/perl.h
@@ -6758,16 +6758,21 @@ extern void moncontrol(int);
# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_LITTLE_ENDIAN || \
LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \
- LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE
# define LONGDOUBLE_LITTLE_ENDIAN
# endif
# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_IEEE_754_128_BIT_BIG_ENDIAN || \
LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN || \
- LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE
# define LONGDOUBLE_BIG_ENDIAN
# endif
+# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE
+# define LONGDOUBLE_MIX_ENDIAN
+# endif
+
# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_LITTLE_ENDIAN || \
LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN
# define LONGDOUBLE_X86_80_BIT
@@ -6776,8 +6781,10 @@ extern void moncontrol(int);
# endif
# endif
-# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN || \
- LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN
+# if LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE
# define LONGDOUBLE_DOUBLEDOUBLE
# endif
@@ -6808,6 +6815,9 @@ extern void moncontrol(int);
# ifdef LONGDOUBLE_BIG_ENDIAN
# define NV_BIG_ENDIAN
# endif
+# ifdef LONGDOUBLE_MIX_ENDIAN
+# define NV_MIX_ENDIAN
+# endif
#endif
/* NaNs (not-a-numbers) can carry payload bits, in addition to
@@ -6923,10 +6933,14 @@ extern void moncontrol(int);
# define NV_NAN_QS_BYTE_OFFSET 7
# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN
# define NV_NAN_QS_BYTE_OFFSET 2
-# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE
# define NV_NAN_QS_BYTE_OFFSET 13
-# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE
# define NV_NAN_QS_BYTE_OFFSET 1
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE
+# define NV_NAN_QS_BYTE_OFFSET 9
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE
+# define NV_NAN_QS_BYTE_OFFSET 6
# else
# error "Unexpected long double format"
# endif
@@ -6968,8 +6982,10 @@ extern void moncontrol(int);
LONG_DOUBLEKIND == LONG_DOUBLE_IS_X86_80_BIT_BIG_ENDIAN)
# define NV_NAN_QS_BIT_SHIFT 6 /* 0x40 */
#elif defined(USE_LONG_DOUBLE) && \
- (LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN || \
- LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN)
+ (LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE || \
+ LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE)
# define NV_NAN_QS_BIT_SHIFT 3 /* 0x08, but not via NV_NAN_BITS */
#else
# define NV_NAN_QS_BIT_SHIFT ((NV_NAN_BITS) % 8) /* usually 3, or 0x08 */
@@ -7010,6 +7026,10 @@ extern void moncontrol(int);
* 0xFF means "don't go here".*/
/* Shorthands to avoid typoses. */
+#define NV_NAN_PAYLOAD_MASK_SKIP_EIGHT \
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
+#define NV_NAN_PAYLOAD_PERM_SKIP_EIGHT \
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
#define NV_NAN_PAYLOAD_PERM_0_TO_7 \
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7
#define NV_NAN_PAYLOAD_PERM_7_TO_0 \
@@ -7088,17 +7108,28 @@ extern void moncontrol(int);
# else
# error "Unexpected x86 80-bit big-endian long double format"
# endif
-# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LITTLE_ENDIAN
-/* For double-double we assume only the first double is used for NaN. */
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_LE
+/* For double-double we assume only the first double (in LE or BE terms)
+ * is used for NaN. */
# define NV_NAN_PAYLOAD_MASK \
- NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE
+ NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE
# define NV_NAN_PAYLOAD_PERM \
- NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE
-# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BIG_ENDIAN
+ NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_BE
# define NV_NAN_PAYLOAD_MASK \
NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE
# define NV_NAN_PAYLOAD_PERM \
NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_LE_BE
+# define NV_NAN_PAYLOAD_MASK \
+ NV_NAN_PAYLOAD_MASK_IEEE_754_64_LE
+# define NV_NAN_PAYLOAD_PERM \
+ NV_NAN_PAYLOAD_PERM_IEEE_754_64_LE
+# elif LONG_DOUBLEKIND == LONG_DOUBLE_IS_DOUBLEDOUBLE_128_BIT_BE_LE
+# define NV_NAN_PAYLOAD_MASK \
+ NV_NAN_PAYLOAD_MASK_SKIP_EIGHT, NV_NAN_PAYLOAD_MASK_IEEE_754_64_BE
+# define NV_NAN_PAYLOAD_PERM \
+ NV_NAN_PAYLOAD_PERM_SKIP_EIGHT, NV_NAN_PAYLOAD_PERM_IEEE_754_64_BE
# else
# error "Unexpected long double format"
# endif