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
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.116 2012/04/06 14:07:52 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.117 2012/04/22 21:50:31 tg Exp $");
/*
* string expansion
@ -392,7 +392,7 @@ expand(const char *cp, /* input word */
h = seed;
NZATUpdateString(h,
str_val(st->var));
NZATFinish(h);
NZAATFinish(h);
x.str = shf_smprintf("%08X",
(unsigned int)h);
break;