use -1 instead of 0 as hash table empty marker

This commit is contained in:
leitner
2018-08-27 14:11:05 +00:00
parent f67e5361c7
commit a3dfae5e7c
2 changed files with 12 additions and 2 deletions

View File

@@ -764,7 +764,8 @@ static int useindex(struct Filter* f,struct bitfield* b) {
uint32 hashtab=ofs+16;
uint32 hashval=f->attrflag&1?hash_tolower((unsigned char*)f->ava.value.s,f->ava.value.l):hash((unsigned char*)f->ava.value.s,f->ava.value.l);
uint32 hashofs=uint32_read(map+hashtab+(hashval%hashtabsize)*4);
if (hashofs==0) return 1;
emptyset(b);
if (hashofs==(uint32)-1) return 1;
if (hashofs<ofs)
/* direct hit */
setbit(b,hashofs);