new hash function is faster than the old

This commit is contained in:
Enno Rehling 2006-02-04 18:53:34 +00:00
parent 939773826b
commit 3cd617fe39
5 changed files with 57 additions and 58 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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;
} }

View File

@ -321,28 +321,28 @@
<string name="wenige"> <string name="wenige">
<text locale="de">wenige</text> <text locale="de">wenige</text>
<text locale="en">few </text> <text locale="en">few</text>
</string> </string>
<string name="viele"> <string name="viele">
<text locale="de">viele</text> <text locale="de">viele</text>
<text locale="en">many </text> <text locale="en">many</text>
</string> </string>
<string name="relativ viele"> <string name="relativ viele">
<text locale="de">relativ viele</text> <text locale="de">relativ viele</text>
<text locale="en">rather many </text> <text locale="en">rather many</text>
</string> </string>
<string name="sehr wenige"> <string name="sehr wenige">
<text locale="de">sehr wenige</text> <text locale="de">sehr wenige</text>
<text locale="en">very few </text> <text locale="en">very few</text>
</string> </string>
<string name="sehr viele"> <string name="sehr viele">
<text locale="de">sehr viele</text> <text locale="de">sehr viele</text>
<text locale="en">a great many </text> <text locale="en">a great many</text>
<text locale="fr">beaucoup de </text> <text locale="fr">beaucoup de</text>
</string> </string>
<string name="nr_spell_description"> <string name="nr_spell_description">