Go to the source code of this file.
◆ XrdOucHashVal2()
| unsigned long XrdOucHashVal2 |
( |
const char * | KeyVal, |
|
|
int | KeyLen ) |
|
extern |
Definition at line 57 of file XrdOucHashVal.cc.
58{ int j;
59 const char *cp;
60 unsigned long hval = 0;
61 int hl = sizeof(hval);
62
63
64
65 if (KeyLen <= hl) return LoadWord(KeyVal, (size_t)KeyLen);
66
67
68
69 hval = KeyLen;
70 j = KeyLen % hl; KeyLen /= hl;
71 if (j) hval ^= LoadWord(KeyVal);
72 cp = &KeyVal[j];
73
74
75
76
77
78 while(KeyLen--)
79 {hval ^= LoadWord(cp);
80 cp += hl;
81 }
82 return (hval ? hval : 1);
83}