diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 15814af..561c352 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -322,8 +322,7 @@ inline void Node3::copyChildrenAndKeyFrom(const Node0 &other) { inline void Node3::copyChildrenAndKeyFrom(const Node3 &other) { memcpy((char *)this + kNodeCopyBegin, (char *)&other + kNodeCopyBegin, kNodeCopySize); - memcpy(index, other.index, - sizeof(*this) - offsetof(Node3, index) + partialKeyLen); + memcpy(index, other.index, sizeof(*this) - sizeof(Node) + partialKeyLen); for (int i = 0; i < numChildren; ++i) { assert(children[i].child->parent == &other); children[i].child->parent = this; @@ -409,7 +408,7 @@ inline void Node48::copyChildrenAndKeyFrom(const Node48 &other) { memcpy((char *)this + kNodeCopyBegin, (char *)&other + kNodeCopyBegin, kNodeCopySize); memcpy(&bitSet, &other.bitSet, - offsetof(Node48, children) - offsetof(Node48, bitSet)); + sizeof(*this) - sizeof(Node) - sizeof(children)); for (int i = 0; i < numChildren; ++i) { children[i] = other.children[i]; assert(children[i].child->parent == &other);