From: Russ Cox Date: Mon, 23 Nov 2009 22:23:14 +0000 (-0800) Subject: two more if(h<0) that gcc 4.3 -O2 miscompiles X-Git-Tag: weekly.2009-12-07~156 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e69f12ae1d2e2206c6104acee31c6639bb93705f;p=gostls13.git two more if(h<0) that gcc 4.3 -O2 miscompiles R=r https://golang.org/cl/160044 --- diff --git a/src/cmd/cc/lexbody b/src/cmd/cc/lexbody index f5a250fcf7..ba5eda8242 100644 --- a/src/cmd/cc/lexbody +++ b/src/cmd/cc/lexbody @@ -226,8 +226,7 @@ lookup(void) for(p=symb; c = *p; p++) h = h+h+h + c; l = (p - symb) + 1; - if(h < 0) - h = ~h; + h &= 0xffffff; h %= NHASH; c = symb[0]; for(s = hash[h]; s != S; s = s->link) { diff --git a/src/libmach/obj.c b/src/libmach/obj.c index aa914e2c76..dacb2ae1fa 100644 --- a/src/libmach/obj.c +++ b/src/libmach/obj.c @@ -257,9 +257,7 @@ objlookup(int id, char *name, int type, uint sig) h = *name; for(cp = name+1; *cp; h += *cp++) h *= HASHMUL; - if(h < 0) - h = ~h; - h &= (NHASH-1); + h &= NHASH-1; if (type == 'U' || type == 'b' || islocal(type)) { for(sp = hash[h]; sp; sp = sp->next) if(strcmp(sp->s.name, name) == 0) {