From 41864f041fd885a8ab397cbd8991f198de8ef05f Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Thu, 12 Sep 2013 14:42:59 +0100 Subject: [PATCH] hint_array pack/unpack --- caching/hint_array.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/caching/hint_array.h b/caching/hint_array.h index 507f362..ec89aeb 100644 --- a/caching/hint_array.h +++ b/caching/hint_array.h @@ -13,11 +13,16 @@ namespace caching { struct hint_traits { typedef unsigned char byte; typedef byte disk_type[WIDTH]; - typedef std::string value_type; + typedef byte value_type[WIDTH]; typedef no_op_ref_counter ref_counter; - static void unpack(disk_type const &disk, value_type &value); - static void pack(value_type const &value, disk_type &disk); + static void unpack(disk_type const &disk, value_type &value) { + ::memcpy(value, disk, sizeof(value)); + } + + static void pack(value_type const &value, disk_type &disk) { + ::memcpy(disk, value, sizeof(disk)); + } }; // FIXME: data visitor stuff