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:
4
eval.c
4
eval.c
@ -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;
|
||||
|
Reference in New Issue
Block a user