ATLAS Offline Software
hash_functions.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef HASH_FUNCTIONS_H
6 #define HASH_FUNCTIONS_H
7 
8 #include <functional>
9 #include <string>
10 
11 namespace SG {
16  inline int simpleStringHash(const std::string& str, int maxInt=0xFFFF) {
17  int h(0), a(127);
18  for (std::string::size_type iC=0; iC<str.size(); iC++)
19  h = (a*h + str[iC]) % maxInt;
20  return h;
21  }
22 
23 }
24 
25 #endif
26 
27 
28 
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
extractSporadic.h
list h
Definition: extractSporadic.py:97
a
TList * a
Definition: liststreamerinfos.cxx:10
h
SG::simpleStringHash
int simpleStringHash(const std::string &str, int maxInt=0xFFFF)
simple hash function derived from Sedgewick Algorithms in C++ 3rd ed
Definition: hash_functions.h:16
str
Definition: BTagTrackIpAccessor.cxx:11