OSDN Git Service

* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wcast-qual.
[pf3gnuchains/gcc-fork.git] / libdecnumber / decUtility.c
index f40ebd4..83f3886 100644 (file)
 
    You should have received a copy of the GNU General Public License
    along with GCC; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
+#include "config.h"
 #include "decNumber.h"          /* base number library */
 #include "decNumberLocal.h"     /* decNumber local types, etc. */
 #include "decUtility.h"         /* utility routines */
@@ -63,7 +64,7 @@
 /* No error is possible.                                              */
 /* ------------------------------------------------------------------ */
 void
-decDensePackCoeff (decNumber * dn, uByte * bytes, Int len, Int shift)
+decDensePackCoeff (const decNumber * dn, uByte * bytes, Int len, Int shift)
 {
   Int cut;                     /* work */
   Int n;                       /* output bunch counter */
@@ -71,7 +72,7 @@ decDensePackCoeff (decNumber * dn, uByte * bytes, Int len, Int shift)
   uInt dpd;                    /* densely packed decimal value */
   uInt bin;                    /* binary value 0-999 */
   uByte *bout;                 /* -> current output byte */
-  Unit *inu = dn->lsu;         /* -> current input unit */
+  const Unit *inu = dn->lsu;   /* -> current input unit */
   Unit uar[DECMAXUNITS];       /* working copy of units, iff shifted */
 #if DECDPUN!=3                 /* not fast path */
   Unit in;                     /* current input unit */
@@ -82,7 +83,8 @@ decDensePackCoeff (decNumber * dn, uByte * bytes, Int len, Int shift)
       /* shift the units array to the left by pad digits and copy */
       /* [this code is a special case of decShiftToMost, which could */
       /* be used instead if exposed and the array were copied first] */
-      Unit *target, *source, *first;   /* work */
+      Unit *target, *first;    /* work */
+      const Unit *source;      /* work */
       uInt next = 0;           /* work */
 
       source = dn->lsu + D2U (digits) - 1;     /* where msu comes from */
@@ -210,12 +212,12 @@ decDensePackCoeff (decNumber * dn, uByte * bytes, Int len, Int shift)
 /* No error is possible [the redundant 888 codes are allowed].        */
 /* ------------------------------------------------------------------ */
 void
-decDenseUnpackCoeff (uByte * bytes, Int len, decNumber * dn,
+decDenseUnpackCoeff (const uByte * bytes, Int len, decNumber * dn,
                     Int bunches, Int odd)
 {
   uInt dpd = 0;                        /* collector for 10 bits */
   Int n;                       /* counter */
-  uByte *bin;                  /* -> current input byte */
+  const uByte *bin;            /* -> current input byte */
   Unit *uout = dn->lsu;                /* -> current output unit */
   Unit out = 0;                        /* accumulator */
   Int cut = 0;                 /* power of ten in current unit */
@@ -347,22 +349,3 @@ decDenseUnpackCoeff (uByte * bytes, Int len, decNumber * dn,
     dn->digits++;              /* zero has one digit */
   return;
 }
-
-unsigned long
-__dec_byte_swap (unsigned long in)
-{
-  unsigned long out;
-  unsigned char *p = (unsigned char *) &out;
-  union {
-    unsigned long 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;
-}