3065 some functions in the tcp module can be static
[unleashed.git] / usr / src / cmd / man / src / util / nsgmls.src / lib / Hash.cxx
blob21b2f4645dfdf854a33b8d7ad10565aae227baf4
1 // Copyright (c) 1994 James Clark
2 // See the file COPYING for copying permission.
3 #pragma ident "%Z%%M% %I% %E% SMI"
5 #ifdef __GNUG__
6 #pragma implementation
7 #endif
8 #include "splib.h"
9 #include "Hash.h"
10 #include "StringC.h"
12 #ifdef SP_NAMESPACE
13 namespace SP_NAMESPACE {
14 #endif
16 unsigned long Hash::hash(const StringC &str)
18 const Char *p = str.data();
19 unsigned long h = 0;
20 for (size_t n = str.size(); n > 0; n--)
21 h = (h << 5) + h + *p++; // from Chris Torek
22 return h;
25 #ifdef SP_NAMESPACE
27 #endif