]> jfr.im git - irc/gameservirc.git/blob - gameserv/hash.cpp
Removed extra output when the refresh period is met (%ld, refreshperiod)
[irc/gameservirc.git] / gameserv / hash.cpp
1 #include "extern.h"
2
3 unsigned long sHASH(const unsigned char *name);
4 unsigned long iHASH(const unsigned char *name);
5 List<aClient> players[U_TABLE_SIZE];
6
7 unsigned long sHASH(const unsigned char *name)
8 {
9 unsigned long h = 0, g;
10
11 while (*name)
12 {
13 h = (h << 4) + (*name++); // Case sensitive for numerics
14 if ((g = (h & 0xF0000000)))
15 h ^= g >> 24;
16 h &= ~g;
17 }
18 return h % U_TABLE_SIZE;
19 }
20
21 unsigned long iHASH(const unsigned char *name)
22 {
23 unsigned long h = 0, g;
24
25 while (*name)
26 {
27 h = (h << 4) + tolower(*name++);
28 if ((g = (h & 0xF0000000)))
29 h ^= g >> 24;
30 h &= ~g;
31 }
32 return h % U_TABLE_SIZE;
33 }
34
35