diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-03-16 09:24:48 +0100 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:25 +0200 |
commit | c61c6d9880739d65e655d1e8b4b491a4010e49c9 (patch) | |
tree | a4e427cd1462f79053a444b3719fcaaeffd927f1 | |
parent | 0769334e2e1c8848757dcf6ca265b6c1dcf98e5d (diff) |
libm: change j0 to _j0 and y1 to _y1 to avoid shadow warning
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r-- | libm/e_hypot.c | 10 | ||||
-rw-r--r-- | libm/e_pow.c | 10 | ||||
-rw-r--r-- | libm/s_ceil.c | 22 | ||||
-rw-r--r-- | libm/s_floor.c | 22 | ||||
-rw-r--r-- | libm/s_llrint.c | 22 | ||||
-rw-r--r-- | libm/s_llround.c | 26 | ||||
-rw-r--r-- | libm/s_lrint.c | 24 | ||||
-rw-r--r-- | libm/s_lround.c | 26 | ||||
-rw-r--r-- | libm/s_modf.c | 16 | ||||
-rw-r--r-- | libm/s_rint.c | 22 | ||||
-rw-r--r-- | libm/s_round.c | 22 | ||||
-rw-r--r-- | libm/s_trunc.c | 16 |
12 files changed, 119 insertions, 119 deletions
diff --git a/libm/e_hypot.c b/libm/e_hypot.c index 264982512..75674548e 100644 --- a/libm/e_hypot.c +++ b/libm/e_hypot.c @@ -46,7 +46,7 @@ double attribute_hidden __ieee754_hypot(double x, double y) { - double a=x,b=y,t1,t2,y1,y2,w; + double a=x,b=y,t1,t2,_y1,y2,w; int32_t j,k,ha,hb; GET_HIGH_WORD(ha,x); @@ -100,13 +100,13 @@ double attribute_hidden __ieee754_hypot(double x, double y) w = __ieee754_sqrt(t1*t1-(b*(-b)-t2*(a+t1))); } else { a = a+a; - y1 = 0; - SET_HIGH_WORD(y1,hb); - y2 = b - y1; + _y1 = 0; + SET_HIGH_WORD(_y1,hb); + y2 = b - _y1; t1 = 0; SET_HIGH_WORD(t1,ha+0x00100000); t2 = a - t1; - w = __ieee754_sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); + w = __ieee754_sqrt(t1*_y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { u_int32_t high; diff --git a/libm/e_pow.c b/libm/e_pow.c index 3be900389..1be740e5e 100644 --- a/libm/e_pow.c +++ b/libm/e_pow.c @@ -94,7 +94,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ double attribute_hidden __ieee754_pow(double x, double y) { double z,ax,z_h,z_l,p_h,p_l; - double y1,t1,t2,r,s,t,u,v,w; + double _y1,t1,t2,r,s,t,u,v,w; int32_t i,j,k,yisint,n; int32_t hx,hy,ix,iy; u_int32_t lx,ly; @@ -249,10 +249,10 @@ double attribute_hidden __ieee754_pow(double x, double y) s = -one;/* (-ve)**(odd int) */ /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1,0); - p_l = (y-y1)*t1+y*t2; - p_h = y1*t1; + _y1 = y; + SET_LOW_WORD(_y1,0); + p_l = (y-_y1)*t1+y*t2; + p_h = _y1*t1; z = p_l+p_h; EXTRACT_WORDS(j,i,z); if (j>=0x40900000) { /* z >= 1024 */ diff --git a/libm/s_ceil.c b/libm/s_ceil.c index ad0916eac..edbf9346f 100644 --- a/libm/s_ceil.c +++ b/libm/s_ceil.c @@ -28,35 +28,35 @@ static const double huge = 1.0e300; double ceil(double x) { - int32_t i0,i1,j0; + int32_t i0,i1,_j0; u_int32_t i,j; EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ + _j0 = ((i0>>20)&0x7ff)-0x3ff; + if(_j0<20) { + if(_j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ if(i0<0) {i0=0x80000000;i1=0;} else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} } } else { - i = (0x000fffff)>>j0; + i = (0x000fffff)>>_j0; if(((i0&i)|i1)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00100000)>>j0; + if(i0>0) i0 += (0x00100000)>>_j0; i0 &= (~i); i1=0; } } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ + } else if (_j0>51) { + if(_j0==0x400) return x+x; /* inf or NaN */ else return x; /* x is integral */ } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); + i = ((u_int32_t)(0xffffffff))>>(_j0-20); if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0>0) { - if(j0==20) i0+=1; + if(_j0==20) i0+=1; else { - j = i1 + (1<<(52-j0)); + j = i1 + (1<<(52-_j0)); if(j<i1) i0+=1; /* got a carry */ i1 = j; } diff --git a/libm/s_floor.c b/libm/s_floor.c index 91f1879be..21d9821e4 100644 --- a/libm/s_floor.c +++ b/libm/s_floor.c @@ -28,36 +28,36 @@ static const double huge = 1.0e300; double floor(double x) { - int32_t i0,i1,j0; + int32_t i0,i1,_j0; u_int32_t i,j; EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; - if(j0<20) { - if(j0<0) { /* raise inexact if x != 0 */ + _j0 = ((i0>>20)&0x7ff)-0x3ff; + if(_j0<20) { + if(_j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ if(i0>=0) {i0=i1=0;} else if(((i0&0x7fffffff)|i1)!=0) { i0=0xbff00000;i1=0;} } } else { - i = (0x000fffff)>>j0; + i = (0x000fffff)>>_j0; if(((i0&i)|i1)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00100000)>>j0; + if(i0<0) i0 += (0x00100000)>>_j0; i0 &= (~i); i1=0; } } - } else if (j0>51) { - if(j0==0x400) return x+x; /* inf or NaN */ + } else if (_j0>51) { + if(_j0==0x400) return x+x; /* inf or NaN */ else return x; /* x is integral */ } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); + i = ((u_int32_t)(0xffffffff))>>(_j0-20); if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0<0) { - if(j0==20) i0+=1; + if(_j0==20) i0+=1; else { - j = i1+(1<<(52-j0)); + j = i1+(1<<(52-_j0)); if(j<i1) i0 +=1 ; /* got a carry */ i1=j; } diff --git a/libm/s_llrint.c b/libm/s_llrint.c index b5f75c2e2..bb22917e3 100644 --- a/libm/s_llrint.c +++ b/libm/s_llrint.c @@ -34,7 +34,7 @@ static const double two52[2] = long long int llrint (double x) { - int32_t j0; + int32_t _j0; u_int32_t i1, i0; long long int result; volatile double w; @@ -42,39 +42,39 @@ llrint (double x) int sx; EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; sx = i0 >> 31; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 < 20) + if (_j0 < 20) { w = two52[sx] + x; t = w - two52[sx]; EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; i0 &= 0xfffff; i0 |= 0x100000; - result = (j0 < 0 ? 0 : i0 >> (20 - j0)); + result = (_j0 < 0 ? 0 : i0 >> (20 - _j0)); } - else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + else if (_j0 < (int32_t) (8 * sizeof (long long int)) - 1) { - if (j0 >= 52) - result = (((long long int) i0 << 32) | i1) << (j0 - 52); + if (_j0 >= 52) + result = (((long long int) i0 << 32) | i1) << (_j0 - 52); else { w = two52[sx] + x; t = w - two52[sx]; EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 == 20) + if (_j0 == 20) result = (long long int) i0; else - result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); + result = ((long long int) i0 << (_j0 - 20)) | (i1 >> (52 - _j0)); } } else diff --git a/libm/s_llround.c b/libm/s_llround.c index 8263b03de..7b554a2de 100644 --- a/libm/s_llround.c +++ b/libm/s_llround.c @@ -24,42 +24,42 @@ long long int llround (double x) { - int32_t j0; + int32_t _j0; u_int32_t i1, i0; long long int result; int sign; EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; sign = (i0 & 0x80000000) != 0 ? -1 : 1; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 < 20) + if (_j0 < 20) { - if (j0 < 0) - return j0 < -1 ? 0 : sign; + if (_j0 < 0) + return _j0 < -1 ? 0 : sign; else { - i0 += 0x80000 >> j0; + i0 += 0x80000 >> _j0; - result = i0 >> (20 - j0); + result = i0 >> (20 - _j0); } } - else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1) + else if (_j0 < (int32_t) (8 * sizeof (long long int)) - 1) { - if (j0 >= 52) - result = (((long long int) i0 << 32) | i1) << (j0 - 52); + if (_j0 >= 52) + result = (((long long int) i0 << 32) | i1) << (_j0 - 52); else { - u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); + u_int32_t j = i1 + (0x80000000 >> (_j0 - 20)); if (j < i1) ++i0; - if (j0 == 20) + if (_j0 == 20) result = (long long int) i0; else - result = ((long long int) i0 << (j0 - 20)) | (j >> (52 - j0)); + result = ((long long int) i0 << (_j0 - 20)) | (j >> (52 - _j0)); } } else diff --git a/libm/s_lrint.c b/libm/s_lrint.c index 3cdc8a253..979d66c59 100644 --- a/libm/s_lrint.c +++ b/libm/s_lrint.c @@ -35,7 +35,7 @@ static const double two52[2] = long int lrint (double x) { - int32_t j0; + int32_t _j0; u_int32_t i0,i1; volatile double w; double t; @@ -43,44 +43,44 @@ lrint (double x) int sx; EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; sx = i0 >> 31; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 < 20) + if (_j0 < 20) { - if (j0 < -1) + if (_j0 < -1) return 0; else { w = two52[sx] + x; t = w - two52[sx]; EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; i0 &= 0xfffff; i0 |= 0x100000; - result = i0 >> (20 - j0); + result = i0 >> (20 - _j0); } } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + else if (_j0 < (int32_t) (8 * sizeof (long int)) - 1) { - if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); + if (_j0 >= 52) + result = ((long int) i0 << (_j0 - 20)) | (i1 << (_j0 - 52)); else { w = two52[sx] + x; t = w - two52[sx]; EXTRACT_WORDS (i0, i1, t); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 == 20) + if (_j0 == 20) result = (long int) i0; else - result = ((long int) i0 << (j0 - 20)) | (i1 >> (52 - j0)); + result = ((long int) i0 << (_j0 - 20)) | (i1 >> (52 - _j0)); } } else diff --git a/libm/s_lround.c b/libm/s_lround.c index acf8fb612..4922abd47 100644 --- a/libm/s_lround.c +++ b/libm/s_lround.c @@ -24,42 +24,42 @@ long int lround (double x) { - int32_t j0; + int32_t _j0; u_int32_t i1, i0; long int result; int sign; EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; sign = (i0 & 0x80000000) != 0 ? -1 : 1; i0 &= 0xfffff; i0 |= 0x100000; - if (j0 < 20) + if (_j0 < 20) { - if (j0 < 0) - return j0 < -1 ? 0 : sign; + if (_j0 < 0) + return _j0 < -1 ? 0 : sign; else { - i0 += 0x80000 >> j0; + i0 += 0x80000 >> _j0; - result = i0 >> (20 - j0); + result = i0 >> (20 - _j0); } } - else if (j0 < (int32_t) (8 * sizeof (long int)) - 1) + else if (_j0 < (int32_t) (8 * sizeof (long int)) - 1) { - if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); + if (_j0 >= 52) + result = ((long int) i0 << (_j0 - 20)) | (i1 << (_j0 - 52)); else { - u_int32_t j = i1 + (0x80000000 >> (j0 - 20)); + u_int32_t j = i1 + (0x80000000 >> (_j0 - 20)); if (j < i1) ++i0; - if (j0 == 20) + if (_j0 == 20) result = (long int) i0; else - result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0)); + result = ((long int) i0 << (_j0 - 20)) | (j >> (52 - _j0)); } } else diff --git a/libm/s_modf.c b/libm/s_modf.c index f73d5fddb..0a2026cea 100644 --- a/libm/s_modf.c +++ b/libm/s_modf.c @@ -26,16 +26,16 @@ static const double one = 1.0; double modf(double x, double *iptr) { - int32_t i0,i1,j0; + int32_t i0,i1,_j0; u_int32_t i; EXTRACT_WORDS(i0,i1,x); - j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ - if(j0<20) { /* integer part in high x */ - if(j0<0) { /* |x|<1 */ + _j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */ + if(_j0<20) { /* integer part in high x */ + if(_j0<0) { /* |x|<1 */ INSERT_WORDS(*iptr,i0&0x80000000,0); /* *iptr = +-0 */ return x; } else { - i = (0x000fffff)>>j0; + i = (0x000fffff)>>_j0; if(((i0&i)|i1)==0) { /* x is integral */ *iptr = x; INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ @@ -45,15 +45,15 @@ double modf(double x, double *iptr) return x - *iptr; } } - } else if (j0>51) { /* no fraction part */ + } else if (_j0>51) { /* no fraction part */ *iptr = x*one; /* We must handle NaNs separately. */ - if (j0 == 0x400 && ((i0 & 0xfffff) | i1)) + if (_j0 == 0x400 && ((i0 & 0xfffff) | i1)) return x*one; INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ return x; } else { /* fraction part in low x */ - i = ((u_int32_t)(0xffffffff))>>(j0-20); + i = ((u_int32_t)(0xffffffff))>>(_j0-20); if((i1&i)==0) { /* x is integral */ *iptr = x; INSERT_WORDS(x,i0&0x80000000,0); /* return +-0 */ diff --git a/libm/s_rint.c b/libm/s_rint.c index 06432c622..02ec404e6 100644 --- a/libm/s_rint.c +++ b/libm/s_rint.c @@ -30,7 +30,7 @@ TWO52[2]={ double rint(double x) { - int32_t i0, j0, sx; + int32_t i0, _j0, sx; u_int32_t i,i1; double t; /* We use w = x + 2^52; t = w - 2^52; trick to round x to integer. @@ -43,11 +43,11 @@ double rint(double x) EXTRACT_WORDS(i0,i1,x); /* Unbiased exponent */ - j0 = ((((u_int32_t)i0) >> 20)&0x7ff)-0x3ff; + _j0 = ((((u_int32_t)i0) >> 20)&0x7ff)-0x3ff; - if (j0 > 51) { + if (_j0 > 51) { //Why bother? Just returning x works too - //if (j0 == 0x400) /* inf or NaN */ + //if (_j0 == 0x400) /* inf or NaN */ // return x+x; return x; /* x is integral */ } @@ -55,8 +55,8 @@ double rint(double x) /* Sign */ sx = ((u_int32_t)i0) >> 31; - if (j0<20) { - if (j0<0) { /* |x| < 1 */ + if (_j0<20) { + if (_j0<0) { /* |x| < 1 */ if (((i0&0x7fffffff)|i1)==0) return x; i1 |= (i0&0x0fffff); i0 &= 0xfffe0000; @@ -68,19 +68,19 @@ double rint(double x) SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); return t; } else { - i = (0x000fffff)>>j0; + i = (0x000fffff)>>_j0; if (((i0&i)|i1)==0) return x; /* x is integral */ i>>=1; if (((i0&i)|i1)!=0) { - if (j0==19) i1 = 0x40000000; - else i0 = (i0&(~i))|((0x20000)>>j0); + if (_j0==19) i1 = 0x40000000; + else i0 = (i0&(~i))|((0x20000)>>_j0); } } } else { - i = ((u_int32_t)(0xffffffff))>>(j0-20); + i = ((u_int32_t)(0xffffffff))>>(_j0-20); if ((i1&i)==0) return x; /* x is integral */ i>>=1; - if ((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); + if ((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(_j0-20)); } INSERT_WORDS(x,i0,i1); w = TWO52[sx]+x; diff --git a/libm/s_round.c b/libm/s_round.c index b3e226308..30a2715c8 100644 --- a/libm/s_round.c +++ b/libm/s_round.c @@ -26,41 +26,41 @@ static const double huge = 1.0e300; double round (double x) { - int32_t i0, j0; + int32_t i0, _j0; u_int32_t i1; EXTRACT_WORDS (i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (_j0 < 20) { - if (j0 < 0) + if (_j0 < 0) { if (huge + x > 0.0) { i0 &= 0x80000000; - if (j0 == -1) + if (_j0 == -1) i0 |= 0x3ff00000; i1 = 0; } } else { - u_int32_t i = 0x000fffff >> j0; + u_int32_t i = 0x000fffff >> _j0; if (((i0 & i) | i1) == 0) /* X is integral. */ return x; if (huge + x > 0.0) { /* Raise inexact if x != 0. */ - i0 += 0x00080000 >> j0; + i0 += 0x00080000 >> _j0; i0 &= ~i; i1 = 0; } } } - else if (j0 > 51) + else if (_j0 > 51) { - if (j0 == 0x400) + if (_j0 == 0x400) /* Inf or NaN. */ return x + x; else @@ -68,7 +68,7 @@ round (double x) } else { - u_int32_t i = 0xffffffff >> (j0 - 20); + u_int32_t i = 0xffffffff >> (_j0 - 20); if ((i1 & i) == 0) /* X is integral. */ return x; @@ -76,7 +76,7 @@ round (double x) if (huge + x > 0.0) { /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (51 - j0)); + u_int32_t j = i1 + (1 << (51 - _j0)); if (j < i1) i0 += 1; i1 = j; diff --git a/libm/s_trunc.c b/libm/s_trunc.c index eb4f6a8f8..987ada95d 100644 --- a/libm/s_trunc.c +++ b/libm/s_trunc.c @@ -24,30 +24,30 @@ double trunc (double x) { - int32_t i0, j0; + int32_t i0, _j0; u_int32_t i1; int sx; EXTRACT_WORDS (i0, i1, x); sx = i0 & 0x80000000; - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) + _j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; + if (_j0 < 20) { - if (j0 < 0) + if (_j0 < 0) /* The magnitude of the number is < 1 so the result is +-0. */ INSERT_WORDS (x, sx, 0); else - INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> j0)), 0); + INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> _j0)), 0); } - else if (j0 > 51) + else if (_j0 > 51) { - if (j0 == 0x400) + if (_j0 == 0x400) /* x is inf or NaN. */ return x + x; } else { - INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20))); + INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (_j0 - 20))); } return x; |