diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-04-01 10:52:41 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-04-01 10:52:41 -0300 |
commit | 7288528a1e081d101a1bc19346a974088b6b8315 (patch) | |
tree | 8a3b73aafaea2d705ea1f53e131d38f29aef52fd /lstring.h | |
parent | 513559cc4760392b6fa33754c516683ef49dba22 (diff) | |
download | lua-7288528a1e081d101a1bc19346a974088b6b8315.tar.gz lua-7288528a1e081d101a1bc19346a974088b6b8315.tar.bz2 lua-7288528a1e081d101a1bc19346a974088b6b8315.zip |
Short strings always use all bytes in the hash
Collisions in short strings occurr just by their existence, when
internalizing them. (Collisions in long strings is caused/controlled
by the program, when adding them as keys to the same table.)
Diffstat (limited to 'lstring.h')
-rw-r--r-- | lstring.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -37,7 +37,8 @@ | |||
37 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) | 37 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) |
38 | 38 | ||
39 | 39 | ||
40 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); | 40 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, |
41 | unsigned int seed, size_t step); | ||
41 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); | 42 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); |
42 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); | 43 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); |
43 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); | 44 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); |