after discussion with ciruZ, switch mksh from NZAT to NZAAT fully

to get rid of the bias introduced by making the hash never zero

… he also pointed out a memory (heap) usage optimisation… which
may impact code size a bit though as I’d need to pass an additional
argument on hashtable function calls… or, forgo the benefit of not
having to pointer-align the key in the structure, which can be as
much as 3/7 octets per item, heap storage… OTOH the saved space is
4/8 octets per not-allocated item, possibly some code (use of an
multiply-add opcode), but the function call overhead/cost would
possibly be quite a bit… I guess I’ll have to measure…
This commit is contained in:
tg
2012-04-22 21:50:35 +00:00
parent 48da83288d
commit 5204e7cc4f
5 changed files with 13 additions and 22 deletions

4
var.c
View File

@ -27,7 +27,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.146 2012/04/14 14:35:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.147 2012/04/22 21:50:35 tg Exp $");
/*-
* Variables
@ -1471,7 +1471,7 @@ hash(const void *s)
NZATInit(h);
NZATUpdateString(h, s);
NZATFinish(h);
NZAATFinish(h);
return (h);
}