diff options
author | Janis Johnson <janis187@us.ibm.com> | 2007-09-10 20:44:08 +0000 |
---|---|---|
committer | Janis Johnson <janis@gcc.gnu.org> | 2007-09-10 20:44:08 +0000 |
commit | 2533577ff6607c4fe093acb0fb711a003a4b3eeb (patch) | |
tree | dc346951fedce72b616d1e6c4be76685c2e68c3a /gcc/dfp.c | |
parent | bfd9cff5c5bbcbea235e60529138848df5222b0c (diff) | |
download | gcc-2533577ff6607c4fe093acb0fb711a003a4b3eeb.zip gcc-2533577ff6607c4fe093acb0fb711a003a4b3eeb.tar.gz gcc-2533577ff6607c4fe093acb0fb711a003a4b3eeb.tar.bz2 |
Makefile.in (libdecnumber_a_OBJS): Remove decUtility.o
2007-09-10 Janis Johnson <janis187@us.ibm.com>
Ben Elliston <bje@au.ibm.com>
libdecnumber/
* Makefile.in (libdecnumber_a_OBJS): Remove decUtility.o
(dependencies): Add Symbols headers.
* decContext.c: Upgrade to decNumber 3.53.
* decContext.h: Ditto.
* decDPD.h: Ditto.
* decNumber.c: Ditto.
* decNumber.h: Ditto.
* decNumberLocal.h: Ditto.
* decBasic.c: New file from decNumber 3.53.
* decCommon.c: Ditto.
* decDouble.c: Ditto.
* decDouble.h: Ditto.
* decQuad.c: Ditto.
* decQuad.h: Ditto.
* decSingle.c: Ditto.
* decSingle.h: Ditto.
* decPacked.c: Ditto.
* decPacked.h: Ditto.
* dpd/decimal128.c: Upgrade to decNumber 3.53.
* dpd/decimal128.h: Ditto.
* dpd/decimal32.c: Ditto.
* dpd/decimal32.h: Ditto.
* dpd/decimal64.c: Ditto.
* dpd/decimal64.h: Ditto.
* decLibrary.c (__dec_byte_swap): Remove.
* decContextSymbols.h: New file.
* decDoubleSymbols.h: New file.
* decNumberSymbols.h: New file.
* decPackedSymbols.h: New file.
* decQuadSymbols.h: New file.
* decSingleSymbols.h: New file.
* decUtility.c: Delete file.
* decUtility.h: Delete file.
* bid/decimal128Symbols.h: New file.
* bid/decimal128Local.h: New file.
* bid/decimal32Symbols.h: New file.
* bid/decimal64Symbols.h: New file.
* bid/host-ieee128.c (__swap128): Remove.
(__host_to_ieee_128, __ieee_to_host_128): Don't handle endianness.
* bid/host-ieee32.c (__dec_type_swap): Remove.
(__host_to_ieee_32, __ieee_to_host_32): Don't handle endianness.
* bid/host-ieee64.c (__swap64): Remove.
(__host_to_ieee_64, __ieee_to_host_64): Don't handle endianness.
* dpd/decimal32Symbols.h: New file.
* dpd/decimal64Symbols.h: New file.
* dpd/decimal128Symbols.h: New file.
* dpd/decimal128Local.h: New file.
libgcc/
* Makefile.in (dfp-filenames): Remove decUtility, add
decDouble, decPacked, decQuad, decSingle.
gcc/
* dfp.c: Include decimal128Local.h;
(dfp_byte_swap): Remove.
(encode_decimal32, decode_decimal32): Don't handle endianness.
(encode_decimal64, decode_decimal64): Ditto.
(encode_decimal128, decode_decimal128): Ditto.
* config/dfp-bit.c (host_to_ieee32, ieee_to_host_32): Ditto.
(__swap64): Remove.
(host_to_ieee_64, ieee_to_host_64): Don't handle endianness.
(__swap128): Remove
(host_to_ieee_128, ieee_to_host_128): Don't handle endianness.
* Makefile.in (DECNUM_H): Add decimal128Local.h.
Co-Authored-By: Ben Elliston <bje@au.ibm.com>
From-SVN: r128350
Diffstat (limited to 'gcc/dfp.c')
-rw-r--r-- | gcc/dfp.c | 90 |
1 files changed, 15 insertions, 75 deletions
@@ -31,29 +31,11 @@ along with GCC; see the file COPYING3. If not see decNumber structure is large enough to hold decimal128 digits. */ #include "decimal128.h" +#include "decimal128Local.h" #include "decimal64.h" #include "decimal32.h" #include "decNumber.h" -static uint32_t -dfp_byte_swap (uint32_t in) -{ - uint32_t out = 0; - unsigned char *p = (unsigned char *) &out; - union { - uint32_t i; - unsigned char b[4]; - } u; - - u.i = in; - p[0] = u.b[3]; - p[1] = u.b[2]; - p[2] = u.b[1]; - p[3] = u.b[0]; - - return out; -} - /* Initialize R (a real with the decimal flag set) from DN. Can utilize status passed in via CONTEXT, if a previous operation had interesting status. */ @@ -155,10 +137,7 @@ encode_decimal32 (const struct real_format *fmt ATTRIBUTE_UNUSED, decimal_to_decnumber (r, &dn); decimal32FromNumber (&d32, &dn, &set); - if (FLOAT_WORDS_BIG_ENDIAN) - buf[0] = *(uint32_t *) d32.bytes; - else - buf[0] = dfp_byte_swap (*(uint32_t *) d32.bytes); + buf[0] = *(uint32_t *) d32.bytes; } /* Decode an IEEE 754R decimal32 type into a real. */ @@ -174,10 +153,7 @@ decode_decimal32 (const struct real_format *fmt ATTRIBUTE_UNUSED, decContextDefault (&set, DEC_INIT_DECIMAL128); set.traps = 0; - if (FLOAT_WORDS_BIG_ENDIAN) - *((uint32_t *) d32.bytes) = (uint32_t) buf[0]; - else - *((uint32_t *) d32.bytes) = dfp_byte_swap ((uint32_t) buf[0]); + *((uint32_t *) d32.bytes) = (uint32_t) buf[0]; decimal32ToNumber (&d32, &dn); decimal_from_decnumber (r, &dn, &set); @@ -199,16 +175,8 @@ encode_decimal64 (const struct real_format *fmt ATTRIBUTE_UNUSED, decimal_to_decnumber (r, &dn); decimal64FromNumber (&d64, &dn, &set); - if (FLOAT_WORDS_BIG_ENDIAN) - { - buf[0] = *(uint32_t *) &d64.bytes[0]; - buf[1] = *(uint32_t *) &d64.bytes[4]; - } - else - { - buf[1] = dfp_byte_swap (*(uint32_t *) &d64.bytes[0]); - buf[0] = dfp_byte_swap (*(uint32_t *) &d64.bytes[4]); - } + buf[0] = *(uint32_t *) &d64.bytes[0]; + buf[1] = *(uint32_t *) &d64.bytes[4]; } /* Decode an IEEE 754R decimal64 type into a real. */ @@ -224,16 +192,8 @@ decode_decimal64 (const struct real_format *fmt ATTRIBUTE_UNUSED, decContextDefault (&set, DEC_INIT_DECIMAL128); set.traps = 0; - if (FLOAT_WORDS_BIG_ENDIAN) - { - *((uint32_t *) &d64.bytes[0]) = (uint32_t) buf[0]; - *((uint32_t *) &d64.bytes[4]) = (uint32_t) buf[1]; - } - else - { - *((uint32_t *) &d64.bytes[0]) = dfp_byte_swap ((uint32_t) buf[1]); - *((uint32_t *) &d64.bytes[4]) = dfp_byte_swap ((uint32_t) buf[0]); - } + *((uint32_t *) &d64.bytes[0]) = (uint32_t) buf[0]; + *((uint32_t *) &d64.bytes[4]) = (uint32_t) buf[1]; decimal64ToNumber (&d64, &dn); decimal_from_decnumber (r, &dn, &set); @@ -255,20 +215,10 @@ encode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED, decimal_to_decnumber (r, &dn); decimal128FromNumber (&d128, &dn, &set); - if (FLOAT_WORDS_BIG_ENDIAN) - { - buf[0] = *(uint32_t *) &d128.bytes[0]; - buf[1] = *(uint32_t *) &d128.bytes[4]; - buf[2] = *(uint32_t *) &d128.bytes[8]; - buf[3] = *(uint32_t *) &d128.bytes[12]; - } - else - { - buf[0] = dfp_byte_swap (*(uint32_t *) &d128.bytes[12]); - buf[1] = dfp_byte_swap (*(uint32_t *) &d128.bytes[8]); - buf[2] = dfp_byte_swap (*(uint32_t *) &d128.bytes[4]); - buf[3] = dfp_byte_swap (*(uint32_t *) &d128.bytes[0]); - } + buf[0] = *(uint32_t *) &d128.bytes[0]; + buf[1] = *(uint32_t *) &d128.bytes[4]; + buf[2] = *(uint32_t *) &d128.bytes[8]; + buf[3] = *(uint32_t *) &d128.bytes[12]; } /* Decode an IEEE 754R decimal128 type into a real. */ @@ -284,20 +234,10 @@ decode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED, decContextDefault (&set, DEC_INIT_DECIMAL128); set.traps = 0; - if (FLOAT_WORDS_BIG_ENDIAN) - { - *((uint32_t *) &d128.bytes[0]) = (uint32_t) buf[0]; - *((uint32_t *) &d128.bytes[4]) = (uint32_t) buf[1]; - *((uint32_t *) &d128.bytes[8]) = (uint32_t) buf[2]; - *((uint32_t *) &d128.bytes[12]) = (uint32_t) buf[3]; - } - else - { - *((uint32_t *) &d128.bytes[0]) = dfp_byte_swap ((uint32_t) buf[3]); - *((uint32_t *) &d128.bytes[4]) = dfp_byte_swap ((uint32_t) buf[2]); - *((uint32_t *) &d128.bytes[8]) = dfp_byte_swap ((uint32_t) buf[1]); - *((uint32_t *) &d128.bytes[12]) = dfp_byte_swap ((uint32_t) buf[0]); - } + *((uint32_t *) &d128.bytes[0]) = (uint32_t) buf[0]; + *((uint32_t *) &d128.bytes[4]) = (uint32_t) buf[1]; + *((uint32_t *) &d128.bytes[8]) = (uint32_t) buf[2]; + *((uint32_t *) &d128.bytes[12]) = (uint32_t) buf[3]; decimal128ToNumber (&d128, &dn); decimal_from_decnumber (r, &dn, &set); |