public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Compare j as unsigned
@ 2023-04-13 17:37 Jeff Johnston
  0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2023-04-13 17:37 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9e89e667299a1f17572930b45661ce98afca76c8

commit 9e89e667299a1f17572930b45661ce98afca76c8
Author: Andoni Arregi <andoni.arregui@gtd-gmbh.de>
Date:   Wed Apr 12 17:34:44 2023 +0200

    Compare j as unsigned
    
    j is int32_t and thus j<<31 is undefined if j==1.
    
    Taken from FreeBSD commit bdd8abc6d6a93ce3ab8ad5db716222ee3110c4a3

Diff:
---
 newlib/libm/math/e_pow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libm/math/e_pow.c b/newlib/libm/math/e_pow.c
index f24a98f6e..0e2251f10 100644
--- a/newlib/libm/math/e_pow.c
+++ b/newlib/libm/math/e_pow.c
@@ -141,7 +141,7 @@ ivln2_l  =  1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
 		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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-13 17:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 17:37 [newlib-cygwin] Compare j as unsigned Jeff Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).