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:
15
sh.h
15
sh.h
@@ -152,9 +152,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.549 2012/04/14 16:07:48 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.550 2012/04/22 21:50:33 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R40 2012/04/14"
|
||||
#define MKSH_VERSION "R40 2012/04/22"
|
||||
|
||||
/* arithmetic types: C implementation */
|
||||
#if !HAVE_CAN_INTTYPES
|
||||
@@ -1491,7 +1491,7 @@ EXTERN struct timeval j_usrtime, j_systime;
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
|
||||
/* NZAT/NZAAT hashes based on Bob Jenkins' one-at-a-time hash */
|
||||
/* NZAAT hash based on Bob Jenkins' one-at-a-time hash */
|
||||
|
||||
/* From: src/kern/include/nzat.h,v 1.2 2011/07/18 00:35:40 tg Exp $ */
|
||||
|
||||
@@ -1524,15 +1524,6 @@ EXTERN struct timeval j_usrtime, j_systime;
|
||||
NZATUpdateByte((h), NZATUpdateString_c); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
/* not zero after termination */
|
||||
#define NZATFinish(h) do { \
|
||||
if ((h) == 0) \
|
||||
++(h); \
|
||||
else \
|
||||
NZAATFinish(h); \
|
||||
} while (/* CONSTCOND */ 0)
|
||||
|
||||
/* NULs zählen an allen Teilen */
|
||||
#define NZAATFinish(h) do { \
|
||||
(h) += (h) << 10; \
|
||||
(h) ^= (h) >> 6; \
|
||||
|
Reference in New Issue
Block a user