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;