[ox/ptrarith] Fix NodeBuffer::compact to iterate over items when item already in correct location

This commit is contained in:
Gary Talent 2019-07-19 19:53:50 -05:00
parent d55089b582
commit 31b75d1e50

View File

@ -357,7 +357,7 @@ template<typename F>
void NodeBuffer<size_t, Item>::compact(F cb) { void NodeBuffer<size_t, Item>::compact(F cb) {
auto src = firstItem(); auto src = firstItem();
auto dest = ptr(sizeof(*this)); auto dest = ptr(sizeof(*this));
while (src.valid() && dest.valid() && dest.offset() < src.offset()) { while (src.valid() && dest.valid() && dest.offset() <= src.offset()) {
// move node // move node
ox_memcpy(dest, src, src.size()); ox_memcpy(dest, src, src.size());
cb(src, dest); cb(src, dest);