Code for logging and replay (doesn't work because of nondet in lua)
This commit is contained in:
@@ -31,18 +31,53 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
class SpookyHash
|
||||
{
|
||||
public:
|
||||
// A hash is two uint64's.
|
||||
//
|
||||
using HashValue = std::pair<uint64_t, uint64_t>;
|
||||
|
||||
//
|
||||
// SpookyHash: hash a single message in one call, produce 128-bit output
|
||||
//
|
||||
static void Hash128(
|
||||
static void ChainHash128(
|
||||
const void *message, // message to hash
|
||||
size_t length, // length of message in bytes
|
||||
uint64_t *hash1, // input seed0, output hash0
|
||||
uint64_t *hash2); // input seed1, output hash1
|
||||
|
||||
|
||||
static inline HashValue QkHash128(const void *message, size_t len) {
|
||||
uint64_t hash1 = 0;
|
||||
uint64_t hash2 = 0;
|
||||
ChainHash128(message, len, &hash1, &hash2);
|
||||
return std::make_pair(hash1, hash2);
|
||||
}
|
||||
|
||||
static inline HashValue QkHash128(std::string_view v) {
|
||||
uint64_t hash1 = 0;
|
||||
uint64_t hash2 = 0;
|
||||
ChainHash128(v.data(), v.size(), &hash1, &hash2);
|
||||
return std::make_pair(hash1, hash2);
|
||||
}
|
||||
|
||||
static inline uint64_t QkHash64(const void *message, size_t len) {
|
||||
uint64_t hash1 = 0;
|
||||
uint64_t hash2 = 0;
|
||||
ChainHash128(message, len, &hash1, &hash2);
|
||||
return hash1;
|
||||
}
|
||||
|
||||
static inline uint64_t QkHash64(std::string_view v) {
|
||||
uint64_t hash1 = 0;
|
||||
uint64_t hash2 = 0;
|
||||
ChainHash128(v.data(), v.size(), &hash1, &hash2);
|
||||
return hash1;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SPOOKYV2_HPP
|
||||
|
||||
Reference in New Issue
Block a user