|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
-** $Id: lstring.c,v 2.54 2015/10/08 15:53:31 roberto Exp roberto $
|
|
|
|
|
|
+** $Id: lstring.c,v 2.55 2015/11/03 15:36:01 roberto Exp roberto $
|
|
** String table (keeps all strings handled by Lua)
|
|
** String table (keeps all strings handled by Lua)
|
|
** See Copyright Notice in lua.h
|
|
** See Copyright Notice in lua.h
|
|
*/
|
|
*/
|
|
@@ -48,10 +48,9 @@ int luaS_eqlngstr (TString *a, TString *b) {
|
|
|
|
|
|
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
|
|
unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
|
|
unsigned int h = seed ^ cast(unsigned int, l);
|
|
unsigned int h = seed ^ cast(unsigned int, l);
|
|
- size_t l1;
|
|
|
|
size_t step = (l >> LUAI_HASHLIMIT) + 1;
|
|
size_t step = (l >> LUAI_HASHLIMIT) + 1;
|
|
- for (l1 = l; l1 >= step; l1 -= step)
|
|
|
|
- h = h ^ ((h<<5) + (h>>2) + cast_byte(str[l1 - 1]));
|
|
|
|
|
|
+ for (; l >= step; l -= step)
|
|
|
|
+ h ^= ((h<<5) + (h>>2) + cast_byte(str[l - 1]));
|
|
return h;
|
|
return h;
|
|
}
|
|
}
|
|
|
|
|