hash_function_string.h - エンジンの C API リファレンス

hash_function_string.h
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string.h>
  4. #include "string.h"
  5. #include "hash_function.h"
  6. namespace stingray_plugin_foundation {
  7. struct string_hash
  8. {
  9. unsigned operator()(const char *t) const {return hash32(t);}
  10. unsigned operator()(const ConstString &t) const {return hash32(t.c_str(), t.size());}
  11. unsigned operator()(const DynamicString &t) const {return hash32(t.c_str(), t.size());}
  12. };
  13. struct string_hash64
  14. {
  15. uint64_t operator()(const char *t) const {return murmur_hash_64(t, strlen32(t),0);}
  16. uint64_t operator()(const ConstString &t) const {return murmur_hash_64(t.c_str(), t.size(),0);}
  17. uint64_t operator()(const DynamicString &t) const {return murmur_hash_64(t.c_str(), t.size(),0);}
  18. };
  19. } // namespace stingray_plugin_foundation