OSDN Git Service

libgfortran:
[pf3gnuchains/gcc-fork.git] / libdecnumber / decUtility.c
index 7543922..2cbed94 100644 (file)
@@ -9,6 +9,15 @@
    Software Foundation; either version 2, or (at your option) any later
    version.
 
+   In addition to the permissions in the GNU General Public License,
+   the Free Software Foundation gives you unlimited permission to link
+   the compiled version of this file into combinations with other
+   programs, and to distribute those combinations without any
+   restriction coming from the use of this file.  (The General Public
+   License restrictions do apply in other respects; for example, they
+   cover modification of the file, and distribution when not linked
+   into a combine executable.)
+
    GCC is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
    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 */
 
-#include "tconfig.h"
-#include "coretypes.h"
-#include "tm.h"
-
 /* ================================================================== */
 /* Shared utility routines                                            */
 /* ================================================================== */
@@ -67,7 +73,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 */
@@ -75,7 +81,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 */
@@ -86,7 +92,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 */
@@ -214,12 +221,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 */
@@ -351,22 +358,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;
-}