hint_array pack/unpack

This commit is contained in:
Joe Thornber 2013-09-12 14:42:59 +01:00
parent a05d75611e
commit 41864f041f

View File

@ -13,11 +13,16 @@ namespace caching {
struct hint_traits { struct hint_traits {
typedef unsigned char byte; typedef unsigned char byte;
typedef byte disk_type[WIDTH]; typedef byte disk_type[WIDTH];
typedef std::string value_type; typedef byte value_type[WIDTH];
typedef no_op_ref_counter<value_type> ref_counter; typedef no_op_ref_counter<value_type> ref_counter;
static void unpack(disk_type const &disk, value_type &value); static void unpack(disk_type const &disk, value_type &value) {
static void pack(value_type const &value, disk_type &disk); ::memcpy(value, disk, sizeof(value));
}
static void pack(value_type const &value, disk_type &disk) {
::memcpy(disk, value, sizeof(disk));
}
}; };
// FIXME: data visitor stuff // FIXME: data visitor stuff