[kaffe] CVS kaffe (gb): libraries/clib/fdlibm/: Such an ancient code assumed "long" as a
Kaffe CVS
cvs-commits at kaffe.org
Fri Sep 23 09:36:34 PDT 2005
PatchSet 6930
Date: 2005/09/23 16:31:52
Author: gb
Branch: HEAD
Tag: (none)
Log:
* libraries/clib/fdlibm/: Such an ancient code assumed "long" as a
32-bit word value, thus changing its occurrences to "int".
Fixes DoublePrint test on 64-bit platforms.
Members:
ChangeLog:1.4452->1.4453
libraries/clib/fdlibm/dtoa.c:1.3->1.4
libraries/clib/fdlibm/mprec.c:1.3->1.4
libraries/clib/fdlibm/mprec.h:1.5->1.6
libraries/clib/fdlibm/strtod.c:1.3->1.4
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4452 kaffe/ChangeLog:1.4453
--- kaffe/ChangeLog:1.4452 Thu Sep 22 20:20:43 2005
+++ kaffe/ChangeLog Fri Sep 23 16:31:52 2005
@@ -1,3 +1,10 @@
+2005-09-23 Gwenole Beauchesne <gbeauchesne at mandriva.com>
+
+ * libraries/clib/fdlibm/: Such an ancient code assumed "long" as a
+ 32-bit word value, thus changing its occurrences to "int".
+
+ Fixes DoublePrint test on 64-bit platforms.
+
2005-09-22 Guilhem Lavaux <guilhem at kaffe.org>
* kaffe/kaffevm/kaffe-gc/gc-incremental.c
Index: kaffe/libraries/clib/fdlibm/dtoa.c
diff -u kaffe/libraries/clib/fdlibm/dtoa.c:1.3 kaffe/libraries/clib/fdlibm/dtoa.c:1.4
--- kaffe/libraries/clib/fdlibm/dtoa.c:1.3 Tue May 31 21:18:30 2005
+++ kaffe/libraries/clib/fdlibm/dtoa.c Fri Sep 23 16:31:53 2005
@@ -35,12 +35,12 @@
_Jv_Bigint * b _AND _Jv_Bigint * S)
{
int n;
- long borrow, y;
- unsigned long carry, q, ys;
- unsigned long *bx, *bxe, *sx, *sxe;
+ int borrow, y;
+ unsigned int carry, q, ys;
+ unsigned int *bx, *bxe, *sx, *sxe;
#ifdef Pack_32
- long z;
- unsigned long si, zs;
+ int z;
+ unsigned int si, zs;
#endif
n = S->_wds;
@@ -145,7 +145,7 @@
print (_Jv_Bigint * b)
{
int i, wds;
- unsigned long *x, y;
+ unsigned int *x, y;
wds = b->_wds;
x = b->_x+wds;
i = 0;
@@ -249,10 +249,10 @@
k_check, leftright, m2, m5, s2, s5, try_quick;
int ilim = 0, ilim1 = 0, spec_case = 0;
union double_union d, d2, eps;
- long L;
+ int L;
#ifndef Sudden_Underflow
int denorm;
- unsigned long x;
+ unsigned int x;
#endif
_Jv_Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S;
double ds;
@@ -441,8 +441,8 @@
default:
break;
}
- j = sizeof (unsigned long);
- for (ptr->_result_k = 0; (int) (sizeof (_Jv_Bigint) - sizeof (unsigned long)) + j <= i;
+ j = sizeof (unsigned int);
+ for (ptr->_result_k = 0; (int) (sizeof (_Jv_Bigint) - sizeof (unsigned int)) + j <= i;
j <<= 1)
ptr->_result_k++;
ptr->_result = Balloc (ptr, ptr->_result_k);
Index: kaffe/libraries/clib/fdlibm/mprec.c
diff -u kaffe/libraries/clib/fdlibm/mprec.c:1.3 kaffe/libraries/clib/fdlibm/mprec.c:1.4
--- kaffe/libraries/clib/fdlibm/mprec.c:1.3 Tue May 31 21:18:30 2005
+++ kaffe/libraries/clib/fdlibm/mprec.c Fri Sep 23 16:31:54 2005
@@ -120,7 +120,7 @@
void
_DEFUN (Bfree, (ptr, v), struct _Jv_reent *ptr _AND _Jv_Bigint * v)
{
- long i;
+ int i;
i = v - ptr->_freelist;
@@ -139,9 +139,9 @@
int a)
{
int i, wds;
- unsigned long *x, y;
+ unsigned int *x, y;
#ifdef Pack_32
- unsigned long xi, z;
+ unsigned int xi, z;
#endif
_Jv_Bigint *b1;
@@ -184,11 +184,11 @@
_CONST char *s _AND
int nd0 _AND
int nd _AND
- unsigned long y9)
+ unsigned int y9)
{
_Jv_Bigint *b;
int i, k;
- long x, y;
+ int x, y;
x = (nd + 8) / 9;
for (k = 0, y = 1; x > y; y <<= 1, k++);
@@ -220,7 +220,7 @@
int
_DEFUN (hi0bits,
- (x), register unsigned long x)
+ (x), register unsigned int x)
{
register int k = 0;
@@ -254,10 +254,10 @@
}
int
-_DEFUN (lo0bits, (y), unsigned long *y)
+_DEFUN (lo0bits, (y), unsigned int *y)
{
register int k;
- register unsigned long x = *y;
+ register unsigned int x = *y;
if (x & 7)
{
@@ -319,10 +319,10 @@
{
_Jv_Bigint *c;
int k, wa, wb, wc;
- unsigned long carry, y, z;
- unsigned long *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
+ unsigned int carry, y, z;
+ unsigned int *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
#ifdef Pack_32
- unsigned long z2;
+ unsigned int z2;
#endif
if (a->_wds < b->_wds)
@@ -450,7 +450,7 @@
{
int i, k1, n, n1;
_Jv_Bigint *b1;
- unsigned long *x, *x1, *xe, z;
+ unsigned int *x, *x1, *xe, z;
#ifdef Pack_32
n = k >> 5;
@@ -508,7 +508,7 @@
int
_DEFUN (cmp, (a, b), _Jv_Bigint * a _AND _Jv_Bigint * b)
{
- unsigned long *xa, *xa0, *xb, *xb0;
+ unsigned int *xa, *xa0, *xb, *xb0;
int i, j;
i = a->_wds;
@@ -541,10 +541,10 @@
{
_Jv_Bigint *c;
int i, wa, wb;
- long borrow, y; /* We need signed shifts here. */
- unsigned long *xa, *xae, *xb, *xbe, *xc;
+ int borrow, y; /* We need signed shifts here. */
+ unsigned int *xa, *xae, *xb, *xbe, *xc;
#ifdef Pack_32
- long z;
+ int z;
#endif
i = cmp (a, b);
@@ -623,7 +623,7 @@
_DEFUN (ulp, (_x), double _x)
{
union double_union x, a;
- register long L;
+ register int L;
x.d = _x;
@@ -669,11 +669,11 @@
_DEFUN (b2d, (a, e),
_Jv_Bigint * a _AND int *e)
{
- unsigned long *xa, *xa0, w, y, z;
+ unsigned int *xa, *xa0, w, y, z;
int k;
union double_union d;
#ifdef VAX
- unsigned long d0, d1;
+ unsigned int d0, d1;
#else
#define d0 word0(d)
#define d1 word1(d)
@@ -754,9 +754,9 @@
union double_union d;
_Jv_Bigint *b;
int de, i, k;
- unsigned long *x, y, z;
+ unsigned int *x, y, z;
#ifdef VAX
- unsigned long d0, d1;
+ unsigned int d0, d1;
d.d = _d;
d0 = word0 (d) >> 16 | word0 (d) << 16;
d1 = word1 (d) >> 16 | word1 (d) << 16;
Index: kaffe/libraries/clib/fdlibm/mprec.h
diff -u kaffe/libraries/clib/fdlibm/mprec.h:1.5 kaffe/libraries/clib/fdlibm/mprec.h:1.6
--- kaffe/libraries/clib/fdlibm/mprec.h:1.5 Fri Sep 16 22:25:16 2005
+++ kaffe/libraries/clib/fdlibm/mprec.h Fri Sep 23 16:31:54 2005
@@ -261,11 +261,9 @@
*/
#ifndef Pack_32
-#if SIZEOF_VOID_P != 8
#define Pack_32
#endif
#endif
-#endif
#define MAX_BIGNUMS 16
@@ -280,7 +278,7 @@
{
struct _Jv_Bigint *_next;
int _k, _maxwds, _sign, _wds;
- unsigned long _x[MAX_BIGNUM_WDS];
+ unsigned int _x[MAX_BIGNUM_WDS];
};
@@ -354,19 +352,19 @@
_Jv_Bigint * _EXFUN(Balloc,(struct _Jv_reent *p, int k));
void _EXFUN(Bfree,(struct _Jv_reent *p, _Jv_Bigint *v));
_Jv_Bigint * _EXFUN(multadd,(struct _Jv_reent *p, _Jv_Bigint *, int, int));
-_Jv_Bigint * _EXFUN(s2b,(struct _Jv_reent *, const char*, int, int, unsigned long));
+_Jv_Bigint * _EXFUN(s2b,(struct _Jv_reent *, const char*, int, int, unsigned int));
_Jv_Bigint * _EXFUN(i2b,(struct _Jv_reent *,int));
_Jv_Bigint * _EXFUN(mult, (struct _Jv_reent *, _Jv_Bigint *, _Jv_Bigint *));
_Jv_Bigint * _EXFUN(pow5mult, (struct _Jv_reent *, _Jv_Bigint *, int k));
-int _EXFUN(hi0bits,(unsigned long));
-int _EXFUN(lo0bits,(unsigned long *));
+int _EXFUN(hi0bits,(unsigned int));
+int _EXFUN(lo0bits,(unsigned int *));
_Jv_Bigint * _EXFUN(d2b,(struct _Jv_reent *p, double d, int *e, int *bits));
_Jv_Bigint * _EXFUN(lshift,(struct _Jv_reent *p, _Jv_Bigint *b, int k));
_Jv_Bigint * _EXFUN(diff,(struct _Jv_reent *p, _Jv_Bigint *a, _Jv_Bigint *b));
int _EXFUN(cmp,(_Jv_Bigint *a, _Jv_Bigint *b));
double _EXFUN(ratio,(_Jv_Bigint *a, _Jv_Bigint *b));
-#define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(long) + 2*sizeof(int))
+#define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(int) + 2*sizeof(int))
#if defined(_DOUBLE_IS_32BITS) && defined(__v800)
#define n_bigtens 2
Index: kaffe/libraries/clib/fdlibm/strtod.c
diff -u kaffe/libraries/clib/fdlibm/strtod.c:1.3 kaffe/libraries/clib/fdlibm/strtod.c:1.4
--- kaffe/libraries/clib/fdlibm/strtod.c:1.3 Tue May 31 21:18:30 2005
+++ kaffe/libraries/clib/fdlibm/strtod.c Fri Sep 23 16:31:54 2005
@@ -111,11 +111,11 @@
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, e1, esign, i, j,
k, nd, nd0, nf, nz, nz0, sign;
int digits = 0; /* Number of digits found in fraction part. */
- long e;
+ int e;
_CONST char *s, *s0, *s1;
double aadj, aadj1, adj;
- long L;
- unsigned long y, z;
+ int L;
+ unsigned int y, z;
union double_union rv, rv0;
_Jv_Bigint *bb = NULL, *bb1, *bd = NULL, *bd0, *bs = NULL, *delta = NULL;
More information about the kaffe
mailing list