p2p/stingray_sdk/plugin_foundation/hash_function_string.h
Lucas Schwiderski 2c9ce46dd2
chore: Rework project structure
There likely won't be much need for multiple separate crates.
2023-05-26 23:42:01 +02:00

24 lines
755 B
C++

#pragma once
#include <stdint.h>
#include <string.h>
#include "string.h"
#include "hash_function.h"
namespace stingray_plugin_foundation {
struct string_hash
{
unsigned operator()(const char *t) const {return hash32(t);}
unsigned operator()(const ConstString &t) const {return hash32(t.c_str(), t.size());}
unsigned operator()(const DynamicString &t) const {return hash32(t.c_str(), t.size());}
};
struct string_hash64
{
uint64_t operator()(const char *t) const {return murmur_hash_64(t, strlen32(t),0);}
uint64_t operator()(const ConstString &t) const {return murmur_hash_64(t.c_str(), t.size(),0);}
uint64_t operator()(const DynamicString &t) const {return murmur_hash_64(t.c_str(), t.size(),0);}
};
} // namespace stingray_plugin_foundation