Skip to content

Commit

Permalink
Windows fixes (#4449)
Browse files Browse the repository at this point in the history
(refreshed previous PR that was conflicting with other changes in
master)

@SirTyson -- I got a warning that `1UL << 36` is UB because the type is
32 bits
  • Loading branch information
MonsieurNicolas authored Sep 6, 2024
2 parents e02d75a + 45291aa commit d95bf47
Show file tree
Hide file tree
Showing 3 changed files with 607 additions and 668 deletions.
6 changes: 3 additions & 3 deletions lib/binaryfusefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ template <typename T> class binary_fuse_t
uint64_t h = binary_fuse_mulhi(hash, SegmentCountLength);
h += index * SegmentLength;
// keep the lower 36 bits
uint64_t hh = hash & ((1UL << 36) - 1);
uint64_t hh = hash & ((1ULL << 36) - 1);
// index 0: right shift by 36; index 1: right shift by 18; index 2: no
// shift
h ^= (size_t)((hh >> (36 - 18 * index)) & SegmentLengthMask);
Expand Down Expand Up @@ -289,9 +289,9 @@ template <typename T> class binary_fuse_t
{
blockBits += 1;
}
uint32_t block = ((uint32_t)1 << blockBits);
uint32_t block = (1ul << blockBits);

std::vector<uint32_t> startPos(1 << blockBits);
std::vector<uint32_t> startPos(block);
uint32_t h012[5];

reverseOrder[size] = 1;
Expand Down
4 changes: 2 additions & 2 deletions src/bucket/BucketSnapshotManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ BucketSnapshotManager::maybeUpdateSnapshot(
{
// Copy current snapshot map into historicalSnapshots
historicalSnapshots.clear();
for (auto const& [ledgerSeq, snapshot] : mHistoricalSnapshots)
for (auto const& [ledgerSeq, snap] : mHistoricalSnapshots)
{
historicalSnapshots.emplace(
ledgerSeq, std::make_unique<BucketListSnapshot>(*snapshot));
ledgerSeq, std::make_unique<BucketListSnapshot>(*snap));
}
}
}
Expand Down
Loading

0 comments on commit d95bf47

Please sign in to comment.