delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/26/15:07:01

X-Authentication-Warning: kendall.sfbr.org: jeffw set sender to jeffw AT darwin DOT sfbr DOT org using -f
Date: Tue, 26 Jun 2001 13:51:49 -0500
From: JT Williams <jeffw AT darwin DOT sfbr DOT org>
To: djgpp-workers AT delorie DOT com
Subject: Re: signed/unsigned in libm
Message-ID: <20010626135149.A6641@kendall.sfbr.org>
Mail-Followup-To: djgpp-workers AT delorie DOT com
References: <20010620135643 DOT B3036 AT kendall DOT sfbr DOT org> <200106201947 DOT VAA23224 AT father DOT ludd DOT luth DOT se>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <200106201947.VAA23224@father.ludd.luth.se>; from ams@ludd.luth.se on Wed, Jun 20, 2001 at 09:47:57PM +0200
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

-: > -: I don't plan to do anything about these as I don't understand the code
-: > -: in question.

Martin,

Here are the casts I came up with.  Several of them were difficult to
decide.  Unfortunately I am not able to test these changes on my setup
(I don't have the resources to compile libc/libm).  I'm sorry I couldn't
be of more help.

jeff


Index: e_pow.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/e_pow.c,v
retrieving revision 1.1
diff -u -3 -r1.1 e_pow.c
--- e_pow.c	1998/10/06 10:04:10	1.1
+++ e_pow.c	2001/06/26 18:40:11
@@ -135,10 +135,10 @@
 		k = (iy>>20)-0x3ff;	   /* exponent */
 		if(k>20) {
 		    j = ly>>(52-k);
-		    if((j<<(52-k))==ly) yisint = 2-(j&1);
+		    if((__uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
 		} else if(ly==0) {
 		    j = iy>>(20-k);
-		    if((j<<(20-k))==iy) yisint = 2-(j&1);
+		    if((__uint32_t)(j<<(20-k))==iy) yisint = 2-(j&1);
 		}
 	    }		
 	} 
Index: e_sqrt.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/e_sqrt.c,v
retrieving revision 1.1
diff -u -3 -r1.1 e_sqrt.c
--- e_sqrt.c	1998/10/06 10:04:10	1.1
+++ e_sqrt.c	2001/06/26 18:40:11
@@ -160,7 +160,7 @@
 	    t  = s0;
 	    if((t<ix0)||((t==ix0)&&(t1<=ix1))) { 
 		s1  = t1+r;
-		if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
+		if(((__int32_t)(t1&sign)==sign)&&(s1&sign)==0) s0 += 1;
 		ix0 -= t;
 		if (ix1 < t1) ix0 -= 1;
 		ix1 -= t1;
Index: ef_j0.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_j0.c,v
retrieving revision 1.1
diff -u -3 -r1.1 ef_j0.c
--- ef_j0.c	1998/02/07 14:13:26	1.1
+++ ef_j0.c	2001/06/26 18:40:12
@@ -74,7 +74,7 @@
 	 * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
 	 * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
 	 */
-		if(ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x);
+		if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x);
 		else {
 		    u = pzerof(x); v = qzerof(x);
 		    z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrtf(x);
@@ -156,7 +156,7 @@
                     if ((s*c)<zero) cc = z/ss;
                     else            ss = z/cc;
                 }
-                if(ix>0x80000000U) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
+                if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*ss)/__ieee754_sqrtf(x);
                 else {
                     u = pzerof(x); v = qzerof(x);
                     z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrtf(x);
Index: ef_j1.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_j1.c,v
retrieving revision 1.1
diff -u -3 -r1.1 ef_j1.c
--- ef_j1.c	1998/02/07 14:13:26	1.1
+++ ef_j1.c	2001/06/26 18:40:12
@@ -75,7 +75,7 @@
 	 * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
 	 * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
 	 */
-		if(ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(y);
+		if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(y);
 		else {
 		    u = ponef(y); v = qonef(y);
 		    z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrtf(y);
Index: ef_jn.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_jn.c,v
retrieving revision 1.1
diff -u -3 -r1.1 ef_jn.c
--- ef_jn.c	1998/02/07 14:13:24	1.1
+++ ef_jn.c	2001/06/26 18:40:12
@@ -197,7 +197,7 @@
 	b = __ieee754_y1f(x);
 	/* quit if b is -inf */
 	GET_FLOAT_WORD(ib,b);
-	for(i=1;i<n&&ib!=0xff800000U;i++){ 
+	for(i=1;i<n&&(__uint32_t)ib!=0xff800000U;i++){ 
 	    temp = b;
 	    b = ((float)(i+i)/x)*b - a;
 	    GET_FLOAT_WORD(ib,b);
Index: ef_pow.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_pow.c,v
retrieving revision 1.1
diff -u -3 -r1.1 ef_pow.c
--- ef_pow.c	1998/10/06 10:04:10	1.1
+++ ef_pow.c	2001/06/26 18:40:12
@@ -217,7 +217,7 @@
 	}
 	else if ((j&0x7fffffff)>0x43160000)		/* z <= -150 */
 	    return s*tiny*tiny;				/* underflow */
-	else if (j==0xc3160000U){			/* z == -150 */
+	else if ((__uint32_t)j==0xc3160000U){		/* z == -150 */
 	    if(p_l<=z-p_h) return s*tiny*tiny;		/* underflow */
 	}
     /*
Index: ef_rem_pio2.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/ef_rem_pio2.c,v
retrieving revision 1.1
diff -u -3 -r1.1 ef_rem_pio2.c
--- ef_rem_pio2.c	1998/10/06 10:04:12	1.1
+++ ef_rem_pio2.c	2001/06/26 18:40:12
@@ -143,7 +143,7 @@
 	    fn = (float)n;
 	    r  = t-fn*pio2_1;
 	    w  = fn*pio2_1t;	/* 1st round good to 40 bit */
-	    if(n<32&&(ix&0xffffff00U)!=npio2_hw[n-1]) {	
+	    if((__int32_t)(n<32&&(ix&0xffffff00U))!=npio2_hw[n-1]) {	
 		y[0] = r-w;	/* quick check no cancellation */
 	    } else {
 	        __uint32_t high;
Index: s_ceil.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/s_ceil.c,v
retrieving revision 1.1
diff -u -3 -r1.1 s_ceil.c
--- s_ceil.c	1998/02/07 13:47:36	1.1
+++ s_ceil.c	2001/06/26 18:40:12
@@ -66,7 +66,7 @@
 		    if(j_0==20) i0+=1; 
 		    else {
 			j = i1 + (1<<(52-j_0));
-			if(j<i1) i0+=1;	/* got a carry */
+			if(j<(__uint32_t)i1) i0+=1;	/* got a carry */
 			i1 = j;
 		    }
 		}
Index: s_floor.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/s_floor.c,v
retrieving revision 1.1
diff -u -3 -r1.1 s_floor.c
--- s_floor.c	1998/02/07 13:47:34	1.1
+++ s_floor.c	2001/06/26 18:40:12
@@ -120,7 +120,7 @@
 		    if(j_0==20) i0+=1; 
 		    else {
 			j = i1+(1<<(52-j_0));
-			if(j<i1) i0 +=1 ; 	/* got a carry */
+			if(j<(__int32_t)i1) i0 +=1 ; 	/* got a carry */
 			i1=j;
 		    }
 		}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019