From a5c9dd3279414b6379dc22f28feee9360f02cfa7 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 3 Apr 2022 09:25:14 -0400 Subject: [PATCH] Fix issue #137 --- parallel_hashmap/phmap_dump.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parallel_hashmap/phmap_dump.h b/parallel_hashmap/phmap_dump.h index a4b8a59..4c38ab1 100644 --- a/parallel_hashmap/phmap_dump.h +++ b/parallel_hashmap/phmap_dump.h @@ -54,9 +54,9 @@ bool raw_hash_set::phmap_dump(OutputArchive& ar) const "value_type should be trivially copyable"); ar.saveBinary(&size_, sizeof(size_t)); + ar.saveBinary(&capacity_, sizeof(size_t)); if (size_ == 0) return true; - ar.saveBinary(&capacity_, sizeof(size_t)); ar.saveBinary(ctrl_, sizeof(ctrl_t) * (capacity_ + Group::kWidth + 1)); ar.saveBinary(slots_, sizeof(slot_type) * capacity_); return true; @@ -69,12 +69,12 @@ bool raw_hash_set::phmap_load(InputArchive& ar) { "value_type should be trivially copyable"); raw_hash_set().swap(*this); // clear any existing content ar.loadBinary(&size_, sizeof(size_t)); - if (size_ == 0) - return true; ar.loadBinary(&capacity_, sizeof(size_t)); // allocate memory for ctrl_ and slots_ initialize_slots(capacity_); + if (size_ == 0) + return true; ar.loadBinary(ctrl_, sizeof(ctrl_t) * (capacity_ + Group::kWidth + 1)); ar.loadBinary(slots_, sizeof(slot_type) * capacity_); return true;