1
0
mirror of https://github.com/golang/go synced 2024-10-02 06:28:33 -06:00

for loops in hashmap.

a few missing FLUSH.

R=ken
OCL=16221
CL=16221
This commit is contained in:
Russ Cox 2008-09-30 14:02:53 -07:00
parent a05c59fe91
commit 1f1ae404f8

View File

@ -131,23 +131,14 @@ hashmap(Sigi *si, Sigt *st)
m->sigi = si;
m->sigt = st;
ni = 1; // skip first word
nt = 0;
loop1:
for(ni=1; (iname=si[ni].name) != nil; ni++) { // ni=1: skip first word
// pick up next name from
// interface signature
iname = si[ni].name;
if(iname == nil) {
m->link = hash[h];
hash[h] = m;
// prints("new hashmap\n");
return m;
}
ihash = si[ni].hash;
loop2:
// pick up and comapre next name
for(;; nt++) {
// pick up and compare next name
// from structure signature
sname = st[nt].name;
if(sname == nil) {
@ -159,16 +150,15 @@ loop2:
hash[h] = m;
return nil;
}
if(ihash != st[nt].hash ||
strcmp(sname, iname) != 0) {
nt++;
goto loop2;
if(ihash == st[nt].hash && strcmp(sname, iname) == 0)
break;
}
m->fun[si[ni].perm] = st[nt].fun;
ni++;
goto loop1;
}
m->link = hash[h];
hash[h] = m;
// prints("new hashmap\n");
return m;
}
// ifaceT2I(sigi *byte, sigt *byte, elem any) (ret any);
@ -196,6 +186,7 @@ sys·ifaceT2I(Sigi *si, Sigt *st, void *elem, Map *retim, void *retit)
}
FLUSH(&retim);
FLUSH(&retit);
}
// ifaceI2T(sigt *byte, iface any) (ret any);
@ -257,6 +248,7 @@ sys·ifaceI2I(Sigi *si, Map *im, void *it, Map *retim, void *retit)
}
FLUSH(&retim);
FLUSH(&retit);
}
void