farmhashnt.cc 660 B

12345678910111213141516171819202122232425262728293031
  1. #include "common.h"
  2. namespace {
  3. #include "farmhashte.cc"
  4. }
  5. namespace farmhashnt {
  6. #if !can_use_sse41 || !x86_64
  7. uint32_t Hash32(const char *s, size_t len) {
  8. FARMHASH_DIE_IF_MISCONFIGURED;
  9. return s == NULL ? 0 : len;
  10. }
  11. uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) {
  12. FARMHASH_DIE_IF_MISCONFIGURED;
  13. return seed + Hash32(s, len);
  14. }
  15. #else
  16. uint32_t Hash32(const char *s, size_t len) {
  17. return static_cast<uint32_t>(farmhashte::Hash64(s, len));
  18. }
  19. uint32_t Hash32WithSeed(const char *s, size_t len, uint32_t seed) {
  20. return static_cast<uint32_t>(farmhashte::Hash64WithSeed(s, len, seed));
  21. }
  22. #endif
  23. } // namespace farmhashnt