forked from github/server
new hash function is faster than the old
This commit is contained in:
parent
939773826b
commit
3cd617fe39
|
@ -321,7 +321,6 @@ enum {
|
||||||
R_AURAKULUM,
|
R_AURAKULUM,
|
||||||
R_SEASERPENTHEAD,
|
R_SEASERPENTHEAD,
|
||||||
R_SPHERE_OF_INVISIBILITY,
|
R_SPHERE_OF_INVISIBILITY,
|
||||||
R_TOADSLIME,
|
|
||||||
R_BAG_OF_HOLDING,
|
R_BAG_OF_HOLDING,
|
||||||
R_SACK_OF_CONSERVATION,
|
R_SACK_OF_CONSERVATION,
|
||||||
R_TACTICCRYSTAL,
|
R_TACTICCRYSTAL,
|
||||||
|
|
|
@ -93,6 +93,8 @@ do_command_i(const struct tnode * keys, void * u, const char * str, struct order
|
||||||
return E_TOK_NOMATCH;
|
return E_TOK_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct unit;
|
||||||
|
struct order;
|
||||||
extern char * getcommand(struct order * ord);
|
extern char * getcommand(struct order * ord);
|
||||||
extern char * unitname(struct unit * u);
|
extern char * unitname(struct unit * u);
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,8 @@ unsigned int
|
||||||
hashstring(const char* s)
|
hashstring(const char* s)
|
||||||
{
|
{
|
||||||
unsigned int key = 0;
|
unsigned int key = 0;
|
||||||
size_t i = strlen(s);
|
while (*s) {
|
||||||
|
key = key*37 + *s++;
|
||||||
while (i>0) {
|
|
||||||
key = (s[--i] + key*37);
|
|
||||||
}
|
}
|
||||||
return key % 0x7FFFFFFF;
|
return key % 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue