0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

ircd:Ⓜ️ Ensure signed integer subtractions are defined.

This commit is contained in:
Jason Volk 2022-07-04 16:19:28 -07:00
parent 7d60b6fddc
commit 29f4620826
2 changed files with 6 additions and 6 deletions

View file

@ -218,7 +218,7 @@ ircd::m::acquire::fetch_history(event::idx &ref_min)
// Fortunately in practice the majority of estimates are close enough.
// XXX /get_missing_events should be considered if there's low
// confidence in a gap estimate.
const auto &limit
const auto limit
{
std::clamp(gap, 1UL, 48UL)
};
@ -557,12 +557,12 @@ ircd::m::acquire::fetch_head(const m::event &result,
const auto gap
{
json::get<"depth"_>(result) - top_depth
uint64_t(json::get<"depth"_>(result)) - top_depth
};
const auto &limit
const auto limit
{
std::clamp(gap, 1L, 48L)
std::clamp(int64_t(gap), 1L, 48L)
};
const auto &hint

View file

@ -211,9 +211,9 @@ ircd::m::room::head::fetch::fetch(const opts &opts,
// The depth comes back as one greater than any existing
// depth so we subtract one.
const auto &depth
const auto depth
{
std::max(json::get<"depth"_>(event) - 1L, 0L)
int64_t(std::max(uint64_t(json::get<"depth"_>(event)) - 1, 0UL))
};
const auto &ots