| 73 | |
| 74 | |
| 75 | static lua_Hash calchash(const char *str, size_t l) { |
| 76 | lua_Hash h = cast(unsigned int, l); /* seed */ |
| 77 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ |
| 78 | size_t l1; |
| 79 | for (l1=l; l1>=step; l1-=step) { /* compute hash */ |
| 80 | h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); |
| 81 | } |
| 82 | return h; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | LUA_API lua_Hash lua_calchash(const char *str, size_t l) { |
no outgoing calls
no test coverage detected