diff --git a/VersionedMap.cpp b/VersionedMap.cpp index b97804d..d1b3e30 100644 --- a/VersionedMap.cpp +++ b/VersionedMap.cpp @@ -91,6 +91,7 @@ struct Entry { // True if the entry is a point mutation. If false, this entry's key should be // read through to the underlying data structure. bool pointMutation() const { return pointVersion >= 0; } + bool pointClear() const { return pointVersion >= 0 && valLen < 0; } // True if mutations in (pred, this) are cleared. If false, (pred, this) // should be read through to the underlying data structure. @@ -1065,8 +1066,7 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev, impl->mutations[impl->mutationCount++] = { prev->getKey(), entry.getKey(), - prev->pointMutation() && prev->valLen < 0 && - prev->pointVersion == entry.rangeVersion + prev->pointClear() && prev->pointVersion == entry.rangeVersion ? prev->keyLen : prev->keyLen + 1, entry.keyLen, @@ -1074,7 +1074,7 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev, entry.rangeVersion}; } if (entry.pointMutation()) { - if (entry.valLen < 0) { + if (entry.valLen < 0 /* pointClear */) { if (next == nullptr || !(next->clearTo() && next->rangeVersion == entry.pointVersion)) { impl->mutations[impl->mutationCount++] = {