Replace loki::clamp_u64 backport with std::clamp

This commit is contained in:
Jason Rhinelander 2020-06-18 16:15:40 -03:00
parent e04d81615c
commit 05f0572155
3 changed files with 4 additions and 12 deletions

View file

@ -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;

View file

@ -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
{

View file

@ -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;