diff options
Diffstat (limited to 'libdecnumber/bid')
-rw-r--r-- | libdecnumber/bid/decimal128Local.h | 1 | ||||
-rw-r--r-- | libdecnumber/bid/decimal128Symbols.h | 1 | ||||
-rw-r--r-- | libdecnumber/bid/decimal32Symbols.h | 1 | ||||
-rw-r--r-- | libdecnumber/bid/decimal64Symbols.h | 1 | ||||
-rw-r--r-- | libdecnumber/bid/host-ieee128.c | 38 | ||||
-rw-r--r-- | libdecnumber/bid/host-ieee32.c | 52 | ||||
-rw-r--r-- | libdecnumber/bid/host-ieee64.c | 33 |
7 files changed, 10 insertions, 117 deletions
diff --git a/libdecnumber/bid/decimal128Local.h b/libdecnumber/bid/decimal128Local.h new file mode 100644 index 00000000000..e499d73bf04 --- /dev/null +++ b/libdecnumber/bid/decimal128Local.h @@ -0,0 +1 @@ +#include "dpd/decimal128Local.h" diff --git a/libdecnumber/bid/decimal128Symbols.h b/libdecnumber/bid/decimal128Symbols.h new file mode 100644 index 00000000000..17757114ae7 --- /dev/null +++ b/libdecnumber/bid/decimal128Symbols.h @@ -0,0 +1 @@ +#include "dpd/decimal128Symbols.h" diff --git a/libdecnumber/bid/decimal32Symbols.h b/libdecnumber/bid/decimal32Symbols.h new file mode 100644 index 00000000000..a0c4bf8cd3c --- /dev/null +++ b/libdecnumber/bid/decimal32Symbols.h @@ -0,0 +1 @@ +#include "dpd/decimal32Symbols.h" diff --git a/libdecnumber/bid/decimal64Symbols.h b/libdecnumber/bid/decimal64Symbols.h new file mode 100644 index 00000000000..5f3069cd62e --- /dev/null +++ b/libdecnumber/bid/decimal64Symbols.h @@ -0,0 +1 @@ +#include "dpd/decimal64Symbols.h" diff --git a/libdecnumber/bid/host-ieee128.c b/libdecnumber/bid/host-ieee128.c index 2c8ea32746a..6d493e5c9d8 100644 --- a/libdecnumber/bid/host-ieee128.c +++ b/libdecnumber/bid/host-ieee128.c @@ -27,56 +27,22 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <limits.h> -#include "config.h" -#include "gstdint.h" #include "bid-dpd.h" #include "decimal128.h" -extern uint32_t __dec_byte_swap (uint32_t); void __host_to_ieee_128 (_Decimal128 in, decimal128 *out); void __ieee_to_host_128 (decimal128 in, _Decimal128 *out); -#ifndef WORDS_BIGENDIAN -#define WORDS_BIGENDIAN 0 -#endif - -static void -__swap128 (char *src, char *dst) -{ - uint32_t t1, t2, t3, t4; - - if (!WORDS_BIGENDIAN) - { - memcpy (&t1, src, 4); - memcpy (&t2, src + 4, 4); - memcpy (&t3, src + 8, 4); - memcpy (&t4, src + 12, 4); - t1 = __dec_byte_swap (t1); - t2 = __dec_byte_swap (t2); - t3 = __dec_byte_swap (t3); - t4 = __dec_byte_swap (t4); - memcpy (dst, &t4, 4); - memcpy (dst + 4, &t3, 4); - memcpy (dst + 8, &t2, 4); - memcpy (dst + 12, &t1, 4); - } - else - memcpy (dst, src, 16); -} - void __host_to_ieee_128 (_Decimal128 in, decimal128 *out) { - __swap128 ((char *) &in, (char *) out); + memcpy ((char *) out, (char *) &in, 16); } void __ieee_to_host_128 (decimal128 in, _Decimal128 *out) { - __swap128 ((char *) &in, (char *) out); + memcpy ((char *) out, (char *) &in, 16); } diff --git a/libdecnumber/bid/host-ieee32.c b/libdecnumber/bid/host-ieee32.c index 639662edfee..9a59c938644 100644 --- a/libdecnumber/bid/host-ieee32.c +++ b/libdecnumber/bid/host-ieee32.c @@ -37,69 +37,21 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA /* The intended way to use this file is to make two copies, add `#define ' to one copy, then compile both copies and add them to libgcc.a. */ -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <limits.h> - -#include "config.h" -#include "gstdint.h" #include "bid-dpd.h" #include "decimal32.h" -uint32_t __dec_byte_swap (uint32_t); void __host_to_ieee_32 (_Decimal32 in, decimal32 *out); void __ieee_to_host_32 (decimal32 in, _Decimal32 *out); -#ifndef WORDS_BIGENDIAN -#define WORDS_BIGENDIAN 0 -#endif - -uint32_t -__dec_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; -} - void __host_to_ieee_32 (_Decimal32 in, decimal32 *out) { - uint32_t t; - - if (!WORDS_BIGENDIAN) - { - memcpy (&t, &in, 4); - t = __dec_byte_swap (t); - memcpy (out, &t, 4); - } - else - memcpy (out, &in, 4); + memcpy ((char *) out, (char *) &in, 4); } void __ieee_to_host_32 (decimal32 in, _Decimal32 *out) { - uint32_t t; - - if (!WORDS_BIGENDIAN) - { - memcpy (&t, &in, 4); - t = __dec_byte_swap (t); - memcpy (out, &t, 4); - } - else - memcpy (out, &in, 4); + memcpy ((char *) out, (char *) &in, 4); } diff --git a/libdecnumber/bid/host-ieee64.c b/libdecnumber/bid/host-ieee64.c index 3c98985244d..ac6cd849efe 100644 --- a/libdecnumber/bid/host-ieee64.c +++ b/libdecnumber/bid/host-ieee64.c @@ -37,50 +37,21 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA /* The intended way to use this file is to make two copies, add `#define ' to one copy, then compile both copies and add them to libgcc.a. */ -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <limits.h> - -#include "config.h" -#include "gstdint.h" #include "bid-dpd.h" #include "decimal64.h" -uint32_t __dec_byte_swap (uint32_t); void __host_to_ieee_64 (_Decimal64 in, decimal64 *out); void __ieee_to_host_64 (decimal64 in, _Decimal64 *out); -#ifndef WORDS_BIGENDIAN -#define WORDS_BIGENDIAN 0 -#endif - -static void -__swap64 (char *src, char *dst) -{ - uint32_t t1, t2; - - if (!WORDS_BIGENDIAN) - { - memcpy (&t1, src, 4); - memcpy (&t2, src + 4, 4); - t1 = __dec_byte_swap (t1); - t2 = __dec_byte_swap (t2); - memcpy (dst, &t2, 4); - memcpy (dst + 4, &t1, 4); - } - else - memcpy (dst, src, 8); -} - void __host_to_ieee_64 (_Decimal64 in, decimal64 *out) { - __swap64 ((char *) &in, (char *) out); + memcpy ((char *) out, (char *) &in, 8); } void __ieee_to_host_64 (decimal64 in, _Decimal64 *out) { - __swap64 ((char *) &in, (char *) out); + memcpy ((char *) out, (char *) &in, 8); } |