X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Sun, 3 Mar 2002 13:31:13 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp-workers AT delorie DOT com Subject: Re: libm signed/unsigned warnings In-Reply-To: <200203022210.XAA05451@father.ludd.luth.se> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk On Sat, 2 Mar 2002, Martin Str|mberg wrote: > > > - if((j<<(52-k))==ly) yisint = 2-(j&1); > > > + if((((__uint32_t)(j))<<(52-k))==ly) yisint = 2-(j&1); > > > > This seems okay, but is mighty ugly. Can you find a better way of > > shutting up GCC in this case? > > Perhaps. But I'd really like somebody who understands the code to make > more extensive changes. What additional changes would you like to suggest? The code is not hard to understand, I think. > > > - if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1; > > > + if((t1&sign)&&(s1&sign)==0) s0 += 1; > > > ix0 -= t; > > > if (ix1 < t1) ix0 -= 1; > > > ix1 -= t1; > > > > > > __int32_t sign = (int)0x80000000U; > > > __uint32_t t1,s1; > > > > > > (t1&sign)==sign checks if the sign bit is set or not. The comparision > > > with sign should be uneccessary. > > > > I don't understand the original problem here: both t1 and sign are > > int's, so why does GCC complain? What is the exact language of the > > warning? > > No. t1 is unsigned. Oops, you are right. > > > - if(ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x); > > > + if((__uint32_t)ix>0x80000000U) z = (invsqrtpi*cc)/__ieee754_sqrtf(x); > > > > I tend to think that this is a bug in the original code, since ix is > > computed a few lines above this like so: > > > > ix = hx&0x7fffffff; > > > > So its high bit can never be set, and the comparison should always > > fail. Am I missing something? > > I'm missing which file we're talking about... It's from ef_j1.c.