This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] upgrade decNumber 1/2
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org, bje at au1 dot ibm dot com
- Date: Sun, 09 Sep 2007 13:13:47 -0700
- Subject: [PATCH] upgrade decNumber 1/2
- Reply-to: janis187 at us dot ibm dot com
This change upgrades the decNumber files in GCC to decNumber 3.53 and
must be applied at the same time as a companion patch to other GCC
files.
decNumber author Mike Cowlishaw uses C block comments for one purpose
and C++ comments for another purpose and isn't willing to change the
comments in his code. Some of the files are used in the GNU C
compiler where we can't use C++ comments, so I put the decNumber sources
through the following filter to change C++ comments to C comments:
col | sed -e 's,\([^:]\)//\(.*\),\1/*\2 */,' -e 's,^//\(.*\),/*\1 */,'
I made a few other changes for use in GCC as shown in the diffs below,
which is not an actual GCC patch.
I replaced the copyright and license notices to match the current
decNumber files in GCC (FSF copyright, GPLv2 or later plus exceptions).
Another change is to include a new file to rename symbols that will be
used in libraries, rather than changing them within a decNumber file
iteself. This will help when other GNU projects copy the GCC decNumber
files.
2007-09-09 Janis Johnson <janis187@us.ibm.com>
libdecnumber/
* 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.
--- decContext.c.orig 2007-09-09 14:21:30.000000000 -0400
+++ decContext.c 2007-09-09 13:56:46.000000000 -0400
@@ -22,6 +22,7 @@
#include <string.h> /* for strcmp */
#include <stdio.h> /* for printf if DECCHECK */
+#include "config.h" /* for GCC definitions */
#include "decContext.h" /* context and base types */
#include "decNumberLocal.h" /* decNumber local types, etc. */
--- decContext.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decContext.h 2007-09-09 13:58:34.000000000 -0400
@@ -41,9 +41,7 @@
#define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */
#define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */
- #if !defined(int32_t)
- #include <stdint.h> /* C99 standard integers */
- #endif
+ #include "gstdint.h" /* C99 standard integers */
#include <stdio.h> /* for printf, etc. */
#include <signal.h> /* for traps */
@@ -223,6 +221,9 @@
#define DEC_INIT_DECQUAD DEC_INIT_DECIMAL128
/* decContext routines */
+
+ #include "decContextSymbols.h"
+
extern decContext * decContextClearStatus(decContext *, uint32_t);
extern decContext * decContextDefault(decContext *, int32_t);
extern enum rounding decContextGetRounding(decContext *);
--- decDouble.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decDouble.h 2007-09-09 14:01:27.000000000 -0400
@@ -46,6 +46,8 @@
/* Routines -- implemented as decFloat routines in common files */
/* ---------------------------------------------------------------- */
+ #include "decDoubleSymbols.h"
+
/* Utilities and conversions, extractors, etc.) */
extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t);
extern decDouble * decDoubleFromInt32(decDouble *, int32_t);
--- decimal128.c.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal128.c 2007-09-09 14:03:52.000000000 -0400
@@ -27,6 +27,7 @@
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
+#include "config.h" /* GCC definitions */
#define DECNUMDIGITS 34 /* make decNumbers with space for 34 */
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
@@ -198,7 +199,7 @@
#define sourlo sourar[0] /* and the lowest word */
/* load source from storage; this is endian */
- pu=(uInt *)d128->bytes; /* overlay */
+ pu=(const uInt *)d128->bytes; /* overlay */
if (DECLITEND) {
sourlo=pu[0]; /* directly load the low int */
sourml=pu[1]; /* then the mid-low */
@@ -292,7 +293,7 @@
#define sourlo sourar[0] /* and the lowest word */
/* load source from storage; this is endian */
- pu=(uInt *)d128->bytes; /* overlay */
+ pu=(const uInt *)d128->bytes; /* overlay */
if (DECLITEND) {
sourlo=pu[0]; /* directly load the low int */
sourml=pu[1]; /* then the mid-low */
--- decimal128.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal128.h 2007-09-09 14:05:44.000000000 -0400
@@ -61,9 +61,14 @@
#define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */
#endif
+ #include "decimal128Local.h"
+
/* ---------------------------------------------------------------- */
/* Routines */
/* ---------------------------------------------------------------- */
+
+ #include "decimal128Symbols.h"
+
/* String conversions */
decimal128 * decimal128FromString(decimal128 *, const char *, decContext *);
char * decimal128ToString(const decimal128 *, char *);
--- decimal32.c.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal32.c 2007-09-09 14:07:12.000000000 -0400
@@ -27,6 +27,7 @@
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
+#include "config.h" /* GCC definitions */
#define DECNUMDIGITS 7 /* make decNumbers with space for 7 */
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
@@ -185,7 +186,7 @@
const uInt *pu; /* work */
/* load source from storage; this is endian */
- pu=(uInt *)d32->bytes; /* overlay */
+ pu=(const uInt *)d32->bytes; /* overlay */
sour=*pu; /* directly load the int */
comb=(sour>>26)&0x1f; /* combination field */
@@ -260,7 +261,7 @@
uInt sour; /* source 32-bit */
/* load source from storage; this is endian */
- pu=(uInt *)d32->bytes; /* overlay */
+ pu=(const uInt *)d32->bytes; /* overlay */
sour=*pu; /* directly load the int */
c=string; /* where result will go */
--- decimal32.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal32.h 2007-09-09 14:08:03.000000000 -0400
@@ -64,6 +64,9 @@
/* ---------------------------------------------------------------- */
/* Routines */
/* ---------------------------------------------------------------- */
+
+ #include "decimal32Symbols.h"
+
/* String conversions */
decimal32 * decimal32FromString(decimal32 *, const char *, decContext *);
char * decimal32ToString(const decimal32 *, char *);
--- decimal64.c.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal64.c 2007-09-09 14:09:04.000000000 -0400
@@ -27,6 +27,7 @@
#include <string.h> /* [for memset/memcpy] */
#include <stdio.h> /* [for printf] */
+#include "config.h" /* GCC definitions */
#define DECNUMDIGITS 16 /* make decNumbers with space for 16 */
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
@@ -213,7 +214,7 @@
#define sourlo sourar[0] /* and the lower word */
/* load source from storage; this is endian */
- pu=(uInt *)d64->bytes; /* overlay */
+ pu=(const uInt *)d64->bytes; /* overlay */
if (DECLITEND) {
sourlo=pu[0]; /* directly load the low int */
sourhi=pu[1]; /* then the high int */
@@ -306,7 +307,7 @@
#define sourlo sourar[0] /* and the lower word */
/* load source from storage; this is endian */
- pu=(uInt *)d64->bytes; /* overlay */
+ pu=(const uInt *)d64->bytes; /* overlay */
if (DECLITEND) {
sourlo=pu[0]; /* directly load the low int */
sourhi=pu[1]; /* then the high int */
--- decimal64.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decimal64.h 2007-09-09 14:10:20.000000000 -0400
@@ -66,6 +66,9 @@
/* ---------------------------------------------------------------- */
/* Routines */
/* ---------------------------------------------------------------- */
+
+ #include "decimal64Symbols.h"
+
/* String conversions */
decimal64 * decimal64FromString(decimal64 *, const char *, decContext *);
char * decimal64ToString(const decimal64 *, char *);
--- decNumber.c.orig 2007-09-09 14:21:30.000000000 -0400
+++ decNumber.c 2007-09-09 14:11:56.000000000 -0400
@@ -163,6 +163,7 @@
#include <stdio.h> /* for printf [if needed] */
#include <string.h> /* for strcpy */
#include <ctype.h> /* for lower */
+#include "config.h" /* for GCC definitions */
#include "decNumber.h" /* base number library */
#include "decNumberLocal.h" /* decNumber local types, etc. */
--- decNumber.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decNumber.h 2007-09-09 14:12:34.000000000 -0400
@@ -95,6 +95,9 @@
/* ---------------------------------------------------------------- */
/* decNumber public functions and macros */
/* ---------------------------------------------------------------- */
+
+ #include "decNumberSymbols.h"
+
/* Conversions */
decNumber * decNumberFromInt32(decNumber *, int32_t);
decNumber * decNumberFromUInt32(decNumber *, uint32_t);
--- decNumberLocal.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decNumberLocal.h 2007-09-09 14:15:11.000000000 -0400
@@ -29,9 +29,15 @@
#include <stdlib.h> /* for abs */
#include <string.h> /* for memset, strcpy */
+ #include "config.h" /* for WORDS_BIGENDIAN */
/* Conditional code flag -- set this to match hardware platform */
- #define DECLITEND 1 /* 1=little-endian, 0=big-endian */
+ /* 1=little-endian, 0=big-endian */
+ #if WORDS_BIGENDIAN
+ #define DECLITEND 0
+ #else
+ #define DECLITEND 1
+ #endif
/* Conditional code flag -- set this to 1 for best performance */
#define DECUSE64 1 /* 1=use int64s, 0=int32 & smaller only */
--- decPacked.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decPacked.h 2007-09-09 14:16:05.000000000 -0400
@@ -43,6 +43,9 @@
/* ---------------------------------------------------------------- */
/* decPacked public routines */
/* ---------------------------------------------------------------- */
+
+ #include "decPackedSymbols.h"
+
/* Conversions */
uint8_t * decPackedFromNumber(uint8_t *, int32_t, int32_t *,
const decNumber *);
--- decQuad.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decQuad.h 2007-09-09 14:17:04.000000000 -0400
@@ -70,6 +70,8 @@
/* Routines -- implemented as decFloat routines in common files */
/* ---------------------------------------------------------------- */
+ #include "decQuadSymbols.h"
+
/* Utilities and conversions, extractors, etc.) */
extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t);
extern decQuad * decQuadFromInt32(decQuad *, int32_t);
--- decSingle.h.orig 2007-09-09 14:21:30.000000000 -0400
+++ decSingle.h 2007-09-09 14:17:58.000000000 -0400
@@ -47,6 +47,8 @@
/* Routines -- implemented as decFloat routines in common files */
/* ---------------------------------------------------------------- */
+ #include "decSingleSymbols.h"
+
/* Utilities (binary argument(s) or result, extractors, etc.) */
extern decSingle * decSingleFromBCD(decSingle *, int32_t, const uint8_t *, int32_t);
extern decSingle * decSingleFromPacked(decSingle *, int32_t, const uint8_t *);