File indexing completed on 2025-01-18 09:38:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_JSON_DETAIL_DIGEST_HPP
0011 #define BOOST_JSON_DETAIL_DIGEST_HPP
0012
0013 namespace boost {
0014 namespace json {
0015 namespace detail {
0016
0017
0018 template<class ForwardIterator>
0019 std::size_t
0020 digest(
0021 ForwardIterator b,
0022 ForwardIterator e,
0023 std::size_t salt) noexcept
0024 {
0025 #if BOOST_JSON_ARCH == 64
0026 std::uint64_t const prime = 0x100000001B3ULL;
0027 std::uint64_t hash = 0xcbf29ce484222325ULL;
0028 #else
0029 std::uint32_t const prime = 0x01000193UL;
0030 std::uint32_t hash = 0x811C9DC5UL;
0031 #endif
0032 hash += salt;
0033 for(; b != e; ++b)
0034 hash = (*b ^ hash) * prime;
0035 return hash;
0036 }
0037
0038 }
0039 }
0040 }
0041
0042 #endif