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.)
This commit is contained in:
Roberto Ierusalimschy
2020-04-01 10:52:41 -03:00
parent 513559cc47
commit 7288528a1e
3 changed files with 10 additions and 7 deletions

View File

@@ -37,7 +37,8 @@
#define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b))
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l,
unsigned int seed, size_t step);
LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);