diff --git a/VersionedMap.cpp b/VersionedMap.cpp index 6e350f3..a705348 100644 --- a/VersionedMap.cpp +++ b/VersionedMap.cpp @@ -459,18 +459,18 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { // The last node is allowed to be 0, in which case this is the search path of // where an entry would exist - template - void move(Finger &finger, int64_t at, bool direction) const { + template + void move(Finger &finger, int64_t at) const { uint32_t c; if (finger.backNode() != 0 && - (c = child(finger.backNode(), direction, at)) != 0) { - finger.push(c, direction); - while ((c = child(finger.backNode(), !direction, at)) != 0) { - finger.push(c, !direction); + (c = child(finger.backNode(), kDirection, at)) != 0) { + finger.push(c, kDirection); + while ((c = child(finger.backNode(), !kDirection, at)) != 0) { + finger.push(c, !kDirection); } } else { while (finger.searchPathSize() > 1 && - finger.backDirection() == direction) { + finger.backDirection() == kDirection) { finger.pop(); } finger.pop(); @@ -639,7 +639,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { if (inserted) { Finger copy; finger.copyTo(copy); - move(copy, latestVersion, true); + move(copy, latestVersion); if (copy.searchPathSize() == 0) { rangeVersion = -1; // Sentinel for "no mutation ending here" } else { @@ -655,7 +655,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { val = {nullptr, -1}; // Sentinel for "no point mutation here" Finger copy; finger.copyTo(copy); - move(copy, latestVersion, true); + move(copy, latestVersion); if (copy.searchPathSize() == 0) { pointVersion = -1; // Sentinel for "no mutation ending here" } else { @@ -801,7 +801,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { } else { search(continueKey, latestRoot, latestVersion, finger); - move(finger, latestVersion, true); + move(finger, latestVersion); if (finger.searchPathSize() == 0) { continueKey = {nullptr, 0}; return; @@ -810,7 +810,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { assert(finger.backNode() != 0); int64_t rangeVersion = mm.base[finger.backNode()].entry->rangeVersion; - move(finger, latestVersion, false); + move(finger, latestVersion); if (finger.searchPathSize() == 0) { continueKey = {nullptr, 0}; return; @@ -829,7 +829,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { } else { rangeVersion = n.entry->rangeVersion; } - move(finger, latestVersion, false); + move(finger, latestVersion); if (finger.searchPathSize() == 0) { continueKey = {nullptr, 0}; return; @@ -866,11 +866,11 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl { Finger iter; search({m.param1, m.param1Len}, latestRoot, latestVersion, iter); - move(iter, latestVersion, true); + move(iter, latestVersion); while (iter.searchPathSize() > 0 && mm.base[iter.backNode()] < Key{m.param2, m.param2Len}) { remove(iter); - move(iter, latestVersion, true); + move(iter, latestVersion); } insert({m.param2, m.param2Len}, {}); } @@ -1023,7 +1023,7 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev, if (prev == nullptr) { Finger copy; impl->finger.copyTo(copy); - impl->map->move(copy, impl->version, false); + impl->map->move(copy, impl->version); if (copy.searchPathSize() > 0) { prev = impl->map->mm.base[copy.backNode()].entry; } else { @@ -1033,7 +1033,7 @@ void materializeMutations(VersionedMap::Iterator::Impl *impl, const Entry *prev, if (next == nullptr) { Finger copy; impl->finger.copyTo(copy); - impl->map->move(copy, impl->version, true); + impl->map->move(copy, impl->version); if (copy.searchPathSize() > 0) { next = impl->map->mm.base[copy.backNode()].entry; } @@ -1078,8 +1078,8 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator++() { do { const auto &entry = *impl->map->mm.base[impl->finger.backNode()].entry; - impl->map->move(impl->finger, impl->version, - true); + impl->map->move(impl->finger, + impl->version); if (impl->finger.searchPathSize() > 0) { materializeMutations(impl, &entry, nullptr); } @@ -1123,8 +1123,8 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() { break; } next = impl->map->mm.base[impl->finger.backNode()].entry; - impl->map->move(impl->finger, impl->version, - false); + impl->map->move(impl->finger, + impl->version); } impl->mutationIndex = impl->mutationCount - 1; return *this; @@ -1132,8 +1132,8 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() { do { const Entry *entry = impl->map->mm.base[impl->finger.backNode()].entry; - impl->map->move(impl->finger, impl->version, - false); + impl->map->move(impl->finger, + impl->version); if (impl->finger.searchPathSize() > 0) { materializeMutations(impl, nullptr, entry); } @@ -1182,7 +1182,7 @@ void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version, exact = false; } else if (finger.backNode() == 0) { exact = false; - move(finger, version[i], true); + move(finger, version[i]); if (finger.searchPathSize() > 0) { assert(finger.backNode() != 0); } @@ -1204,8 +1204,8 @@ void VersionedMap::Impl::firstGeq(const Key *key, const int64_t *version, break; } prev = iterator[i].impl->map->mm.base[finger.backNode()].entry; - iterator[i].impl->map->move( - finger, iterator[i].impl->version, true); + iterator[i].impl->map->move( + finger, iterator[i].impl->version); } if (exact) { iterator[i].impl->mutationIndex = iterator[i].impl->mutationCount - 1; @@ -1257,8 +1257,8 @@ VersionedMap::Iterator VersionedMap::begin(int64_t version) const { break; } prev = result.impl->map->mm.base[result.impl->finger.backNode()].entry; - result.impl->map->move( - result.impl->finger, result.impl->version, true); + result.impl->map->move( + result.impl->finger, result.impl->version); } result.impl->mutationIndex = 0;