diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-20 18:15:32 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-20 18:15:32 +0000 |
commit | 37c0e98af2ab7fbeb307019a20e572def4f1ddb6 (patch) | |
tree | 02312684c58dea559b7ade43ab30abc86c9ea0a8 /vespalib | |
parent | b693d572df945b9e82798e0c40b8b7b565f6a4a8 (diff) |
Separate where you nede an actual hash, and where you want the string hashed to a double.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/locale/c.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/string_hash.cpp | 6 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/string_hash.h | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/vespalib/src/vespa/vespalib/locale/c.cpp b/vespalib/src/vespa/vespalib/locale/c.cpp index f6d71857d5a..ffc29b2e104 100644 --- a/vespalib/src/vespa/vespalib/locale/c.cpp +++ b/vespalib/src/vespa/vespalib/locale/c.cpp @@ -3,7 +3,7 @@ #include "c.h" #include "locale.h" #include <cstdlib> -#include <errno.h> +#include <cerrno> namespace vespalib::locale::c { diff --git a/vespalib/src/vespa/vespalib/util/string_hash.cpp b/vespalib/src/vespa/vespalib/util/string_hash.cpp index 572ba765743..0e8b93dca04 100644 --- a/vespalib/src/vespa/vespalib/util/string_hash.cpp +++ b/vespalib/src/vespa/vespalib/util/string_hash.cpp @@ -4,7 +4,7 @@ namespace vespalib { -uint32_t hash_code(const char *str, size_t len) { +double hash2d(const char *str, size_t len) { uint32_t hash = 0; for (size_t i = 0; i < len; ++i) { hash = (hash << 5) - hash + str[i]; @@ -12,8 +12,8 @@ uint32_t hash_code(const char *str, size_t len) { return hash; } -uint32_t hash_code(vespalib::stringref str) { - return hash_code(str.data(), str.size()); +double hash2d(vespalib::stringref str) { + return hash2d(str.data(), str.size()); } } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/string_hash.h b/vespalib/src/vespa/vespalib/util/string_hash.h index 14a5a85a009..495a8378b42 100644 --- a/vespalib/src/vespa/vespalib/util/string_hash.h +++ b/vespalib/src/vespa/vespalib/util/string_hash.h @@ -9,8 +9,8 @@ namespace vespalib { /** * simple string hashing function similar to the one used by Java. **/ -uint32_t hash_code(const char *str, size_t len); -uint32_t hash_code(vespalib::stringref str); +double hash2d(const char *str, size_t len); +double hash2d(vespalib::stringref str); } // namespace vespalib |