merge from gcc
authorDJ Delorie <dj@redhat.com>
Mon, 27 Oct 2008 18:25:21 +0000 (18:25 +0000)
committerDJ Delorie <dj@redhat.com>
Mon, 27 Oct 2008 18:25:21 +0000 (18:25 +0000)
libdecnumber/ChangeLog
libdecnumber/decBasic.c
libdecnumber/decDouble.h
libdecnumber/decNumberLocal.h
libdecnumber/decQuad.h
libdecnumber/decSingle.h

index a89179b3d7e9210023b5410b6636cee37b6cd657..eec08665135e2a8c625a9f1a05436d1732243a36 100644 (file)
@@ -1,3 +1,15 @@
+2008-10-27  Janis Johnson  <janis187@us.ibm.com>
+
+       PR other/37897
+       * decDouble.h (decDouble): Replace struct with union accessible
+       by more types.
+       * decSingle.h (decSingle): Ditto.
+       * decQuad.h (decQuad): Ditto.
+       * decNumberLocal.h (DFWORD, DFBYTE, DFWWORD): access decFloat via
+       new members.
+       * decBasic.c (decFloatCompareTotal): Avoid type-pun violation.
+       (decNumberCompare): Ditto.
+
 2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * Makefile.in ($(srcdir)/aclocal.m4): Update dependencies.
index 9ce277d2c30e8be733b64f0a4a920afeca9be242..fddba9790531cbc17b5c67963c0fe8dc106b9487 100644 (file)
@@ -1660,8 +1660,10 @@ decFloat * decFloatCompareTotal(decFloat *result,
       /* decode the coefficients */
       /* (shift both right two if Quad to make a multiple of four) */
       #if QUAD
-       USHORTAT(bufl)=0;
-       USHORTAT(bufr)=0;
+       ub = bufl;                           /* avoid type-pun violation */
+       USHORTAT(ub)=0;
+       uc = bufr;                           /* avoid type-pun violation */
+       USHORTAT(uc)=0;
       #endif
       GETCOEFF(dfl, bufl+QUAD*2);           /* decode from decFloat */
       GETCOEFF(dfr, bufr+QUAD*2);           /* .. */
@@ -3542,8 +3544,10 @@ static Int decNumCompare(const decFloat *dfl, const decFloat *dfr, Flag tot) {
   /* decode the coefficients */
   /* (shift both right two if Quad to make a multiple of four) */
   #if QUAD
-    UINTAT(bufl)=0;
-    UINTAT(bufr)=0;
+    ub=bufl;                            /* avoid type-pun violation */
+    UINTAT(ub)=0;
+    uc=bufr;                            /* avoid type-pun violation */
+    UINTAT(uc)=0;
   #endif
   GETCOEFF(dfl, bufl+QUAD*2);          /* decode from decFloat */
   GETCOEFF(dfr, bufr+QUAD*2);          /* .. */
index 32eba395d8570d777d228f2b05cd3c49f445d1ac..53fcf406bec5608854c2d398f8019f4706db2aea 100644 (file)
   #include "decContext.h"
   #include "decQuad.h"
 
-  /* The decDouble decimal 64-bit type, accessible by bytes */
-  typedef struct {
+  /* The decDouble decimal 64-bit type, accessible by various types */
+  typedef union {
     uint8_t bytes[DECDOUBLE_Bytes]; /* fields: 1, 5, 8, 50 bits          */
+    uint16_t shorts[DECDOUBLE_Bytes/2];
+    uint32_t words[DECDOUBLE_Bytes/4];
     } decDouble;
 
   /* ---------------------------------------------------------------- */
index 809eaa466a22bc4050dcd6eb7b668199dee248fe..f1568f725e115879826bc7faf72fedc017cfc6af 100644 (file)
   #define DECWORDS  (DECBYTES/4)
   #define DECWWORDS (DECWBYTES/4)
   #if DECLITEND
-    #define DFWORD(df, off) UINTAT((df)->bytes+(DECWORDS-1-(off))*4)
-    #define DFBYTE(df, off) UBYTEAT((df)->bytes+(DECBYTES-1-(off)))
-    #define DFWWORD(dfw, off) UINTAT((dfw)->bytes+(DECWWORDS-1-(off))*4)
+    #define DFWORD(df, off) ((df)->words[DECWORDS-1-(off)])
+    #define DFBYTE(df, off) ((df)->bytes[DECBYTES-1-(off)])
+    #define DFWWORD(dfw, off) ((dfw)->words[DECWWORDS-1-(off)])
   #else
-    #define DFWORD(df, off) UINTAT((df)->bytes+(off)*4)
-    #define DFBYTE(df, off) UBYTEAT((df)->bytes+(off))
-    #define DFWWORD(dfw, off) UINTAT((dfw)->bytes+(off)*4)
+    #define DFWORD(df, off) ((df)->words[off])
+    #define DFBYTE(df, off) ((df)->bytes[off])
+    #define DFWWORD(dfw, off) ((dfw)->words[off])
   #endif
 
   /* Tests for sign or specials, directly on DECFLOATs               */
index 39f75d33e3a9b9feadde0f8d8dcaac20e5b2a88d..af9bc24e26543d545ee0e8c79d0a0dc5c36f3cde 100644 (file)
   /* Required include                                                */
   #include "decContext.h"
 
-  /* The decQuad decimal 128-bit type, accessible by bytes */
-  typedef struct {
+  /* The decQuad decimal 128-bit type, accessible by various types */
+  typedef union {
     uint8_t bytes[DECQUAD_Bytes];  /* fields: 1, 5, 12, 110 bits */
+    uint16_t shorts[DECQUAD_Bytes/2];
+    uint32_t words[DECQUAD_Bytes/4];
     } decQuad;
 
   /* ---------------------------------------------------------------- */
index 8dd1bd38ac0d8a9e504e74f08ed47226cad1d30f..bae39848eed7d084eec80b440265f4e223d008cd 100644 (file)
   #include "decQuad.h"
   #include "decDouble.h"
 
-  /* The decSingle decimal 32-bit type, accessible by bytes */
-  typedef struct {
+  /* The decSingle decimal 32-bit type, accessible by various types */
+  typedef union {
     uint8_t bytes[DECSINGLE_Bytes];    /* fields: 1, 5, 6, 20 bits */
+    uint16_t shorts[DECSINGLE_Bytes/2];
+    uint32_t words[DECSINGLE_Bytes/4];
     } decSingle;
 
   /* ---------------------------------------------------------------- */
This page took 0.034171 seconds and 4 git commands to generate.