CBMC
Loading...
Searching...
No Matches
string_hash.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: string hashing
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#include "string_hash.h"
13
14std::size_t hash_string(std::string_view s)
15{
16 return hash_string(s.data(), s.size());
17}
18
19std::size_t hash_string(const char *s, std::size_t len)
20{
21 std::size_t h = 0;
22
23 for(; len != 0; --len, ++s)
24 h = (h << 5) - h + *s;
25
26 return h;
27}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:566
std::size_t hash_string(std::string_view s)
string hashing