From adc376a573a83316f9faeebc0c38511cb2e00a38 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 2 May 2024 14:35:22 -0700 Subject: [PATCH] Linux fixes + bug fix in bitset size calculation --- VersionedMap.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/VersionedMap.cpp b/VersionedMap.cpp index e5c53d0..fc3059b 100644 --- a/VersionedMap.cpp +++ b/VersionedMap.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include #include @@ -127,7 +129,7 @@ constexpr uint32_t kUpsizeNodes = kUpsizeBytes / sizeof(Node); static_assert(kUpsizeNodes * sizeof(Node) == kUpsizeBytes); struct BitSet { - explicit BitSet(uint32_t size) : words((uint64_t *)malloc(size / 64 + 64)) {} + explicit BitSet(uint32_t size) : words((uint64_t *)malloc(size / 8 + 8)) {} bool test(uint32_t i) const { return words[i >> 6] & (uint64_t(1) << (i & 63)); @@ -393,6 +395,7 @@ struct VersionedMap::Impl { template uint32_t child(uint32_t node, bool which, int64_t at) { + static_assert(kOrder == std::memory_order_acquire || kOrder == std::memory_order_relaxed); auto &n = mm.base[node]; if (n.updated.load(kOrder) && n.updateVersion <= at && which == n.replacedPointer) { @@ -576,4 +579,4 @@ int main() { }); } } -#endif \ No newline at end of file +#endif