Skip to content

Commit

Permalink
remove MurmurHash 3 implementation, switch to std::hash<std::string>
Browse files Browse the repository at this point in the history
  • Loading branch information
wjakob committed Nov 1, 2023
1 parent e2cf292 commit e172484
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 99 deletions.
1 change: 0 additions & 1 deletion cmake/nanobind-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ function (nanobind_build_library TARGET_NAME)

${NB_DIR}/src/buffer.h
${NB_DIR}/src/hash.h
${NB_DIR}/src/hash.cpp
${NB_DIR}/src/nb_internals.h
${NB_DIR}/src/nb_internals.cpp
${NB_DIR}/src/nb_func.cpp
Expand Down
94 changes: 0 additions & 94 deletions src/hash.cpp

This file was deleted.

2 changes: 0 additions & 2 deletions src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ inline uint64_t fmix64(uint64_t k) {
k ^= k >> 33;
return k;
}

extern uint64_t MurmurHash3_x64_64(const void *key, size_t len, uint32_t seed);
5 changes: 3 additions & 2 deletions src/nb_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <nanobind/nanobind.h>
#include <tsl/robin_map.h>
#include <cstring>
#include <string>
#include <functional>
#include "hash.h"

#if defined(_MSC_VER)
Expand Down Expand Up @@ -151,8 +153,7 @@ struct nb_weakref_seq {

struct std_typeinfo_hash {
size_t operator()(const std::type_info *a) const {
const char *name = a->name();
return (size_t) MurmurHash3_x64_64(name, strlen(name), 0);
return std::hash<std::string>()(a->name());
}
};

Expand Down

0 comments on commit e172484

Please sign in to comment.