diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-09-15 17:06:46 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-09-15 17:06:46 -0400 |
commit | 89c89d11070fb2c05e8a883f0d047ab3cd8f8a4c (patch) | |
tree | 857fa43e61108d43a169ba52c0d0509f5d94683d /gcc/config/fp-bit.c | |
parent | 6136d594d931622e71aa909d6709dbda712bfdc8 (diff) | |
download | gcc-89c89d11070fb2c05e8a883f0d047ab3cd8f8a4c.zip gcc-89c89d11070fb2c05e8a883f0d047ab3cd8f8a4c.tar.gz gcc-89c89d11070fb2c05e8a883f0d047ab3cd8f8a4c.tar.bz2 |
(FLO_union_type): Add words field if double precision to get at the separate words.
(FLO_union_type): Add words field if double precision to get at the separate
words.
(FLO_union_type, pack_d, unpack_d): Use FLOAT_BIT_ORDER_MISMATCH to
determine when the bitfields need to be reversed, and
FLOAT_WORD_ORDER_MISMATCH when the words need to be reversed.
From-SVN: r10357
Diffstat (limited to 'gcc/config/fp-bit.c')
-rw-r--r-- | gcc/config/fp-bit.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gcc/config/fp-bit.c b/gcc/config/fp-bit.c index 6c7491e..4ee08f1 100644 --- a/gcc/config/fp-bit.c +++ b/gcc/config/fp-bit.c @@ -243,7 +243,11 @@ typedef union FLO_type value; fractype value_raw; -#ifdef FLOAT_WORD_ORDER_MISMATCH +#ifndef FLOAT + halffractype words[2]; +#endif + +#ifdef FLOAT_BIT_ORDER_MISMATCH struct { fractype fraction:FRACBITS __attribute__ ((packed)); @@ -254,8 +258,6 @@ typedef union #endif #ifdef _DEBUG_BITFLOAT - halffractype l[2]; - struct { unsigned int sign:1 __attribute__ ((packed)); @@ -414,7 +416,7 @@ pack_d ( fp_number_type * src) /* We previously used bitfields to store the number, but this doesn't handle little/big endian systems conviently, so use shifts and masks */ -#ifdef FLOAT_WORD_ORDER_MISMATCH +#ifdef FLOAT_BIT_ORDER_MISMATCH dst.bits.fraction = fraction; dst.bits.exp = exp; dst.bits.sign = sign; @@ -424,6 +426,14 @@ pack_d ( fp_number_type * src) dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS); #endif +#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) + { + halffractype tmp = dst.words[0]; + dst.words[0] = dst.words[1]; + dst.words[1] = tmp; + } +#endif + return dst.value; } @@ -437,7 +447,15 @@ unpack_d (FLO_union_type * src, fp_number_type * dst) int exp; int sign; -#ifdef FLOAT_WORD_ORDER_MISMATCH +#if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT) + FLO_union_type swapped; + + swapped.words[0] = src->words[1]; + swapped.words[1] = src->words[0]; + src = &swapped; +#endif + +#ifdef FLOAT_BIT_ORDER_MISMATCH fraction = src->bits.fraction; exp = src->bits.exp; sign = src->bits.sign; |