XRootD
Loading...
Searching...
No Matches
XrdOucHashVal.cc File Reference
#include "string.h"
#include "strings.h"
Include dependency graph for XrdOucHashVal.cc:

Go to the source code of this file.

Functions

unsigned long XrdOucHashVal (const char *KeyVal)
unsigned long XrdOucHashVal2 (const char *KeyVal, int KeyLen)

Function Documentation

◆ XrdOucHashVal()

unsigned long XrdOucHashVal ( const char * KeyVal)

Definition at line 52 of file XrdOucHashVal.cc.

53 {extern unsigned long XrdOucHashVal2(const char *, int);
54 return XrdOucHashVal2(KeyVal, strlen(KeyVal));
55 }
unsigned long XrdOucHashVal2(const char *KeyVal, int KeyLen)

References XrdOucHashVal2().

Referenced by XrdOucHash< T >::Add(), XrdOucHash< T >::Del(), and XrdOssSys::Stage_RT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ XrdOucHashVal2()

unsigned long XrdOucHashVal2 ( const char * KeyVal,
int KeyLen )

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// If name is shorter than the hash length, use the name.
64//
65 if (KeyLen <= hl) return LoadWord(KeyVal, (size_t)KeyLen);
66
67// Compute the length of the name and develop starting hash.
68//
69 hval = KeyLen;
70 j = KeyLen % hl; KeyLen /= hl;
71 if (j) hval ^= LoadWord(KeyVal);
72 cp = &KeyVal[j];
73
74// Compute and return the full hash. The key is walked with a byte pointer
75// since it is not aligned for unsigned long; LoadWord() does the unaligned
76// load, and the word arithmetic happens on the copy.
77//
78 while(KeyLen--)
79 {hval ^= LoadWord(cp);
80 cp += hl;
81 }
82 return (hval ? hval : 1);
83}

Referenced by XrdAccCapability::XrdAccCapability(), XrdAccAccess::Access(), XrdOucN2No2p::pfn2lfn(), XrdAccCapability::Privs(), XrdAccCapability::Privs(), and XrdOucHashVal().

Here is the caller graph for this function: