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