44 lines
1.2 KiB
C++
Raw Normal View History

2013-11-19 10:24:31 +00:00
#include "era/era_detail.h"
#include <stdexcept>
using namespace base;
using namespace era;
//----------------------------------------------------------------
namespace {
2014-01-08 15:31:42 +00:00
#if 0
2013-11-19 10:24:31 +00:00
le32 pack_hash_detail(uint32_t hash1, uint32_t hash2, uint32_t nr_probes) {
throw std::runtime_error("not implemented");
}
void unpack_hash_detail(le32 packed, uint32_t &hash1, uint32_t &hash2, uint32_t &nr_probes) {
throw std::runtime_error("not implemented");
}
2014-01-08 15:31:42 +00:00
#endif
2013-11-19 10:24:31 +00:00
}
void
era_detail_traits::unpack(disk_type const &disk, value_type &value)
{
2014-01-08 15:31:42 +00:00
value.nr_blocks = to_cpu<uint32_t>(disk.nr_blocks);
2013-11-19 10:24:31 +00:00
value.nr_bits = to_cpu<uint32_t>(disk.nr_bits);
2014-01-08 15:31:42 +00:00
value.nr_set = to_cpu<uint32_t>(disk.nr_set);
2013-11-19 10:24:31 +00:00
value.bloom_root = to_cpu<uint64_t>(disk.bloom_root);
2014-01-08 15:31:42 +00:00
//unpack_hash_detail(disk.hash_fns_and_probes, value.hash1, value.hash2, value.nr_probes);
2013-11-19 10:24:31 +00:00
}
void
era_detail_traits::pack(value_type const &value, disk_type &disk)
{
2014-01-08 15:31:42 +00:00
disk.nr_blocks = to_disk<le32>(value.nr_blocks);
2013-11-19 10:24:31 +00:00
disk.nr_bits = to_disk<le32>(value.nr_bits);
2014-01-08 15:31:42 +00:00
disk.nr_set = to_disk<le32>(value.nr_set);
2013-11-19 10:24:31 +00:00
disk.bloom_root = to_disk<le64>(value.bloom_root);
2014-01-08 15:31:42 +00:00
// disk.hash_fns_and_probes = pack_hash_detail(value.hash1, value.hash2, value.nr_probes);
2013-11-19 10:24:31 +00:00
}
//----------------------------------------------------------------