sdkhjfdsv
This commit is contained in:
parent
1aec6085d9
commit
537aa6e404
16 changed files with 683 additions and 71 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#define ALIGN(n) (((n) + 7) & ~7)
|
||||
|
||||
static Sy *find(St *tab, U32 hash, Z len) {
|
||||
static Sy *find(St *tab, const char *str, U32 hash, Z len) {
|
||||
if (tab->capacity == 0)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -17,6 +17,8 @@ static Sy *find(St *tab, U32 hash, Z len) {
|
|||
return NULL;
|
||||
if (s->hash == hash && s->len == len)
|
||||
return s;
|
||||
if (memcmp(s->data, str, len) == 0)
|
||||
return s;
|
||||
ix = (ix + 1) % tab->capacity;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -55,7 +57,7 @@ Sy *intern(St *tab, const char *str, Z len) {
|
|||
if (len == 0)
|
||||
len = strlen(str);
|
||||
U32 hash = hashstr(str, len);
|
||||
Sy *sym = find(tab, hash, len);
|
||||
Sy *sym = find(tab, str, hash, len);
|
||||
if (sym)
|
||||
return sym;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue