core: Make hash functions thread-safe

This commit is contained in:
F5
2022-10-08 11:51:03 +08:00
parent 34b8e39172
commit 2825400936

View File

@@ -281,28 +281,44 @@ inline
uint32_t
Hash32 (const char * buffer, const std::size_t size)
{
#ifdef NS3_MTP
return Hasher ().GetHash32 (buffer, size);
#else
return GetStaticHash ().GetHash32 (buffer, size);
#endif
}
inline
uint64_t
Hash64 (const char * buffer, const std::size_t size)
{
#ifdef NS3_MTP
return Hasher ().GetHash64 (buffer, size);
#else
return GetStaticHash ().GetHash64 (buffer, size);
#endif
}
inline
uint32_t
Hash32 (const std::string s)
{
#ifdef NS3_MTP
return Hasher ().GetHash32 (s);
#else
return GetStaticHash ().GetHash32 (s);
#endif
}
inline
uint64_t
Hash64 (const std::string s)
{
#ifdef NS3_MTP
return Hasher ().GetHash64 (s);
#else
return GetStaticHash ().GetHash64 (s);
#endif
}