summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-11-04 07:07:19 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2014-11-04 07:14:37 -0500
commitac52a899378c1b28715ed80f23f21d43357072ac (patch)
tree6bc02a6f4fd26248e93a3f962a69cd30c2d250a6 /sv.c
parentc9c33d61e6ec8971ac0bb8d6e462378787d1a5ab (diff)
downloadperl-ac52a899378c1b28715ed80f23f21d43357072ac.tar.gz
I shouldn't think of fp formats when tired.
Or awake, come to think of it.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/sv.c b/sv.c
index 8d55ef6664..181da58266 100644
--- a/sv.c
+++ b/sv.c
@@ -10999,35 +10999,38 @@ S_hextract(pTHX_ const NV nv, int* exponent, U8* vhex, U8* vend)
* also need to insert the radix. */
HEXTRACT_IMPLICIT_BIT(nv);
# ifdef HEXTRACT_LITTLE_ENDIAN
+ /* 0 1 2 3 4 5 6 7 (MSB = 7, LSB = 0, 6+7 = exponent+sign) */
HEXTRACT_LO_NYBBLE(6);
for (ix = 5; ix >= 0; ix--) {
HEXTRACT_BYTE(ix);
}
# elif defined(HEXTRACT_BIG_ENDIAN)
+ /* 7 6 5 4 3 2 1 0 (MSB = 7, LSB = 0, 6+7 = exponent+sign) */
HEXTRACT_LO_NYBBLE(1);
for (ix = 2; ix < NVSIZE; ix++) {
HEXTRACT_BYTE(ix);
}
+# elif DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE
+ /* 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0, 6+7 = exponent+sign) */
+ HEXTRACT_LO_NYBBLE(2); /* 6 */
+ HEXTRACT_BYTE(1); /* 5 */
+ HEXTRACT_BYTE(0); /* 4 */
+ HEXTRACT_BYTE(7); /* 3 */
+ HEXTRACT_BYTE(6); /* 2 */
+ HEXTRACT_BYTE(5); /* 1 */
+ HEXTRACT_BYTE(4); /* 0 */
+# elif DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE
+ /* 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0, 7+6 = sign+exponent) */
+ HEXTRACT_LO_NYBBLE(5); /* 6 */
+ HEXTRACT_BYTE(6); /* 5 */
+ HEXTRACT_BYTE(7); /* 4 */
+ HEXTRACT_BYTE(0); /* 3 */
+ HEXTRACT_BYTE(1); /* 2 */
+ HEXTRACT_BYTE(2); /* 1 */
+ HEXTRACT_BYTE(3); /* 0 */
# else
-# if DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_LE_BE
- /* 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0, 6+7 = exponent+sign) */
- HEXTRACT_BYTE(2);
- HEXTRACT_BYTE(1);
- HEXTRACT_BYTE(7);
- HEXTRACT_BYTE(6);
- HEXTRACT_BYTE(5);
- HEXTRACT_BYTE(4);
-# elif DOUBLEKIND == DOUBLE_IS_IEEE_754_64_BIT_MIXED_ENDIAN_BE_LE
- /* 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0, 0+1 = sign+exponent) */
- HEXTRACT_BYTE(4);
- HEXTRACT_BYTE(5);
- HEXTRACT_BYTE(6);
- HEXTRACT_BYTE(7);
- HEXTRACT_BYTE(0);
- HEXTRACT_BYTE(1);
-# else
-# error "Unknown DOUBLEKIND"
-# endif
+ /* XXX restore fallback to frexp+ldexp */
+ error "Unexpected DOUBLEKIND"
# endif
#endif
/* Croak for various reasons: if the output pointer escaped the