mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Update hash_append to latest draft specification
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <BeastConfig.h>
|
||||
#endif
|
||||
|
||||
#include <beast/hash/endian.h>
|
||||
#include <beast/hash/tests/hash_metrics.h>
|
||||
#include <beast/hash/hash_append.h>
|
||||
#include <beast/chrono/chrono_io.h>
|
||||
@@ -120,8 +121,10 @@ private:
|
||||
std::uint64_t state_ = 14695981039346656037u;
|
||||
|
||||
public:
|
||||
static beast::endian const endian = beast::endian::native;
|
||||
|
||||
void
|
||||
append (void const* key, std::size_t len) noexcept
|
||||
operator() (void const* key, std::size_t len) noexcept
|
||||
{
|
||||
unsigned char const* p = static_cast<unsigned char const*>(key);
|
||||
unsigned char const* const e = p + len;
|
||||
@@ -143,8 +146,10 @@ private:
|
||||
std::uint32_t state_ = 2166136261;
|
||||
|
||||
public:
|
||||
static beast::endian const endian = beast::endian::native;
|
||||
|
||||
void
|
||||
append (void const* key, std::size_t len) noexcept
|
||||
operator() (void const* key, std::size_t len) noexcept
|
||||
{
|
||||
unsigned char const* p = static_cast<unsigned char const*>(key);
|
||||
unsigned char const* const e = p + len;
|
||||
@@ -171,8 +176,10 @@ private:
|
||||
std::size_t state_ = 0;
|
||||
|
||||
public:
|
||||
static beast::endian const endian = beast::endian::native;
|
||||
|
||||
void
|
||||
append (void const* key, std::size_t len) noexcept
|
||||
operator() (void const* key, std::size_t len) noexcept
|
||||
{
|
||||
unsigned char const* p = static_cast <unsigned char const*>(key);
|
||||
unsigned char const* const e = p + len;
|
||||
@@ -200,13 +207,15 @@ private:
|
||||
SpookyHash state_;
|
||||
|
||||
public:
|
||||
static beast::endian const endian = beast::endian::native;
|
||||
|
||||
spooky(std::size_t seed1 = 1, std::size_t seed2 = 2) noexcept
|
||||
{
|
||||
state_.Init(seed1, seed2);
|
||||
}
|
||||
|
||||
void
|
||||
append(void const* key, std::size_t len) noexcept
|
||||
operator()(void const* key, std::size_t len) noexcept
|
||||
{
|
||||
state_.Update(key, len);
|
||||
}
|
||||
@@ -253,7 +262,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
append (void const* data, std::size_t bytes) noexcept
|
||||
operator() (void const* data, std::size_t bytes) noexcept
|
||||
{
|
||||
base::operator() (data, bytes);
|
||||
}
|
||||
@@ -340,9 +349,10 @@ public:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<>
|
||||
struct is_contiguously_hashable <hash_append_tests::FastKey>
|
||||
: std::true_type
|
||||
template <class HashAlgorithm>
|
||||
struct is_contiguously_hashable <hash_append_tests::FastKey, HashAlgorithm>
|
||||
: std::integral_constant<bool, is_contiguously_hashable<std::array <std::size_t, 4>,
|
||||
HashAlgorithm>::value>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user