mirror of
https://github.com/Zygo/bees.git
synced 2025-06-17 01:56:16 +02:00
hash: prepare for user-selectable hash functions
Localize the hash function in bees to a single spot to make it easier to change later (or at runtime). Remove some code that was using a property of CRC as an optimization. The optimization doesn't work for other hash functions, and running the CRC function takes more CPU time than the optimization saved. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "bees.h"
|
||||
|
||||
#include "crucible/city.h"
|
||||
#include "crucible/crc64.h"
|
||||
#include "crucible/string.h"
|
||||
|
||||
@ -11,6 +12,12 @@
|
||||
using namespace crucible;
|
||||
using namespace std;
|
||||
|
||||
BeesHash::BeesHash(const uint8_t *ptr, size_t len) :
|
||||
// m_hash(CityHash64(reinterpret_cast<const char *>(ptr), len))
|
||||
m_hash(Digest::CRC::crc64(ptr, len))
|
||||
{
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator<<(ostream &os, const BeesHash &bh)
|
||||
{
|
||||
|
Reference in New Issue
Block a user