diff options
| author | Martin Ridgers <[email protected]> | 2024-09-12 15:26:06 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2024-09-19 15:26:13 +0200 |
| commit | 93bd1be0c6dc35fc270755eb498382e4a58fcb52 (patch) | |
| tree | 38e84f77291e7f88d3b4e94189deeb1a49a234b7 /src | |
| parent | Placate clang (diff) | |
| download | zen-93bd1be0c6dc35fc270755eb498382e4a58fcb52.tar.xz zen-93bd1be0c6dc35fc270755eb498382e4a58fcb52.zip | |
Forgot there was a std::clamp
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index b58f490e2..0e1fb2e9a 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -2065,13 +2065,10 @@ ProjectStore::Oplog::IterateOplogLocked(std::function<void(CbObjectView)>&& Hand std::span<OplogEntryAddress> EntrySpan; if (EntryPaging != nullptr) { - int32_t Indices[2] = {EntryPaging->Start, EntryPaging->Start + EntryPaging->Count}; - for (int32_t& Index : Indices) - { - Index = std::max<int32_t>(0, Index); - Index = std::min<int32_t>(Index, int32_t(Entries.size())); - } - EntrySpan = decltype(EntrySpan)(Entries.begin() + Indices[0], Indices[1] - Indices[0]); + int32_t Size = int32_t(Entries.size()); + int32_t Start = std::clamp(EntryPaging->Start, 0, Size); + int32_t End = std::clamp(EntryPaging->Start + EntryPaging->Count, 0, Size); + EntrySpan = decltype(EntrySpan)(Entries.begin() + Start, End - Start); } else { |