[cityhash] Cleanup
This commit is contained in:
parent
1a8afa1a98
commit
59aa4ad21a
54
deps/ox/deps/cityhash/include/cityhash/city.h
vendored
54
deps/ox/deps/cityhash/include/cityhash/city.h
vendored
@ -100,27 +100,52 @@ typedef uint32_t uintptr_t;
|
||||
#error intptr_t, and uintptr_t undefined
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
using size_t = decltype(alignof(int));
|
||||
|
||||
|
||||
|
||||
#if __has_include(<utility>)
|
||||
#include <utility>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace cityhash::detail {
|
||||
|
||||
template<typename T>
|
||||
struct remove_reference {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct remove_reference<T&> {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct remove_reference<T&&> {
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using remove_reference_t = typename remove_reference<T>::type;
|
||||
|
||||
template<typename T>
|
||||
constexpr remove_reference_t<T> &&move(T &&t) noexcept {
|
||||
return static_cast<remove_reference_t<T>&&>(t);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
using remove_reference_t = typename remove_reference<T>::type;
|
||||
template<typename T1, typename T2>
|
||||
struct pair {
|
||||
T1 first{};
|
||||
T2 second{};
|
||||
constexpr pair() noexcept = default;
|
||||
constexpr pair(T1 a, T2 b) noexcept: first(std::move(a)), second(std::move(b)) {}
|
||||
constexpr pair(T1 a, T2 b) noexcept: first(detail::move(a)), second(detail::move(b)) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
constexpr void swap(T &a, T &b) noexcept {
|
||||
auto temp = detail::move(a);
|
||||
a = detail::move(b);
|
||||
b = detail::move(temp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace cityhash {
|
||||
@ -129,13 +154,6 @@ using uint128 = cityhash::detail::pair<uint64_t, uint64_t>;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
constexpr void swap(T &a, T &b) noexcept {
|
||||
auto temp = std::move(a);
|
||||
a = std::move(b);
|
||||
b = std::move(temp);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
constexpr T byteSwap(T i) noexcept {
|
||||
@ -290,7 +308,7 @@ constexpr uint32_t Hash32Len0to4(const char *s, size_t len) noexcept {
|
||||
uint32_t b = 0;
|
||||
uint32_t c = 9;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
signed char v = static_cast<signed char>(s[i]);
|
||||
auto const v = static_cast<signed char>(s[i]);
|
||||
b = b * detail::c1 + static_cast<uint32_t>(v);
|
||||
c ^= b;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user