1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:17:56 -07:00

two more if(h<0) that gcc 4.3 -O2 miscompiles

R=r
https://golang.org/cl/160044
This commit is contained in:
Russ Cox 2009-11-23 14:23:14 -08:00
parent b90f673290
commit e69f12ae1d
2 changed files with 2 additions and 5 deletions

View File

@ -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) {

View File

@ -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) {