Matthew Guthaus
02/25/2022, 4:54 PMTim Edwards
02/25/2022, 4:55 PMMatthew Guthaus
02/25/2022, 4:55 PMMatthew Guthaus
02/25/2022, 4:55 PMTim Edwards
02/25/2022, 4:58 PMMatthew Guthaus
02/25/2022, 4:58 PMMatthew Guthaus
02/25/2022, 5:01 PMMatthew Guthaus
02/25/2022, 5:02 PMMatthew Guthaus
02/25/2022, 5:02 PMTim Edwards
02/25/2022, 5:22 PMTim Edwards
02/25/2022, 5:26 PMTim Edwards
02/25/2022, 5:30 PMMatthew Guthaus
02/25/2022, 7:07 PMTim Edwards
02/25/2022, 7:13 PMMitch Bailey
02/25/2022, 10:59 PMgds flatglob *_?mos_m*
for the sram modules.Matthew Guthaus
02/25/2022, 11:05 PMMatthew Guthaus
02/25/2022, 11:13 PMMatthew Guthaus
02/26/2022, 12:29 AMTim Edwards
02/26/2022, 2:05 AMTim Edwards
02/26/2022, 3:16 AMMatthew Guthaus
02/26/2022, 3:21 AMMatthew Guthaus
02/26/2022, 3:22 AMMitch Bailey
02/26/2022, 1:51 PMTim Edwards
02/26/2022, 3:08 PMMitch Bailey
02/26/2022, 3:39 PMstruct hashlist *HashInt2PtrInstall(char *name, int c, void *ptr,
struct hashdict *dict)
{
struct hashlist *np;
unsigned long hashval;
hashval = genhash(name, c, dict->hashsize);
for (np = dict->hashtab[hashval]; np != NULL; np = np->next)
if (!strcmp(name, np->name)) {
np->ptr = ptr;
return (np); /* match found in hash table */
}
/* not in table, so install it */
if ((np = (struct hashlist *) CALLOC(1,sizeof(struct hashlist))) == NULL)
return (NULL);
if ((np->name = strsave(name)) == NULL) return (NULL);
np->ptr = ptr;
np->next = dict->hashtab[hashval];
return(dict->hashtab[hashval] = np);
}
HashInt2PtrInstall
calls genhash
to create a hash with c
as a file number.
unsigned long genhash(char *s, int c, int hashsize)
{
unsigned long hashval;
for (hashval = (unsigned long)c; *s != '\0'; )
hashval = (*s++) + (hashval << 6) + (hashval << 16) - hashval;
return (hashsize == 0) ? hashval : (hashval % hashsize);
}
genhash
begins the hash creation with c
. So when file number is 0, it's the same as a hash without the file number, but any other file number will give a different hash.
And then in
void *HashInt2Lookup(char *s, int c, struct hashdict *dict)
{
struct hashlist *np;
unsigned long hashval;
hashval = genhash(s, c, dict->hashsize);
for (np = dict->hashtab[hashval]; np != NULL; np = np->next)
if (!strcmp(s, np->name))
return (np->ptr); /* correct match */
return (NULL); /* not found */
}
The file number is again used in the hash creation, but only the name is checked in the bucket lookup! So theoretically, if the same name occurred in both files and generated the same hash, this routine would only return the first one found (which may not be from the correct file). Currently c
is not stored in the hash, so there's no way to check it.
Am I missing something?Mitch Bailey
02/26/2022, 3:45 PMgenhash
is case-sensitive only.
Also, I'm working on a patch that will do dynamic hash resizing.Tim Edwards
02/27/2022, 1:04 AM