mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Replace loki::clamp_u64 backport with std::clamp
This commit is contained in:
parent
e04d81615c
commit
05f0572155
3 changed files with 4 additions and 12 deletions
|
@ -4111,8 +4111,8 @@ std::vector<checkpoint_t> BlockchainLMDB::get_checkpoints_range(uint64_t start,
|
|||
if (!get_top_checkpoint(top_checkpoint)) return result;
|
||||
if (!get_block_checkpoint_internal(0, bottom_checkpoint, MDB_FIRST)) return result;
|
||||
|
||||
start = loki::clamp_u64(start, bottom_checkpoint.height, top_checkpoint.height);
|
||||
end = loki::clamp_u64(end, bottom_checkpoint.height, top_checkpoint.height);
|
||||
start = std::clamp(start, bottom_checkpoint.height, top_checkpoint.height);
|
||||
end = std::clamp(end, bottom_checkpoint.height, top_checkpoint.height);
|
||||
if (start > end)
|
||||
{
|
||||
if (start < bottom_checkpoint.height) return result;
|
||||
|
|
|
@ -44,14 +44,6 @@ namespace loki
|
|||
double round (double);
|
||||
double exp2 (double);
|
||||
|
||||
constexpr uint64_t clamp_u64(uint64_t val, uint64_t min, uint64_t max)
|
||||
{
|
||||
assert(min <= max);
|
||||
if (val < min) val = min;
|
||||
else if (val > max) val = max;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <typename lambda_t>
|
||||
struct deferred
|
||||
{
|
||||
|
|
|
@ -90,8 +90,8 @@ struct TestDB: public BaseTestDB
|
|||
if (!get_top_checkpoint(top_checkpoint)) return result;
|
||||
checkpoint_t bottom_checkpoint = checkpoints.front();
|
||||
|
||||
start = loki::clamp_u64(start, bottom_checkpoint.height, top_checkpoint.height);
|
||||
end = loki::clamp_u64(end, bottom_checkpoint.height, top_checkpoint.height);
|
||||
start = std::clamp(start, bottom_checkpoint.height, top_checkpoint.height);
|
||||
end = std::clamp(end, bottom_checkpoint.height, top_checkpoint.height);
|
||||
if (start > end)
|
||||
{
|
||||
if (start < bottom_checkpoint.height) return result;
|
||||
|
|
Loading…
Reference in a new issue