ref: 079edb19cc359122f59436ee54397a31ed80d338
parent: beec9be442f8bfe07e16b719f33bc4558cfed994
author: Jacob Moody <[email protected]>
date: Tue Dec 10 06:23:39 EST 2019
use unsigned for map hash
--- a/dat.c
+++ b/dat.c
@@ -6,10 +6,11 @@
#include "dat.h"
#include "fncs.h"
-int
+uvlong
string2hash(char *s)
{
- int hash, i;
+ int i;
+ uvlong hash;
hash = 7;
for(i=0;i<strlen(s);i++)
hash = hash*31 + s[i];
@@ -29,6 +30,7 @@
mapinsert(Hmap *h, char *key, void *val)
{
Hnode *n;
+
wlock(h);
n = h->nodes+(string2hash(key)%h->size);
assert(n != nil);