mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
* ADL for AlmostEqual* and use math:: instead of base:: Signed-off-by: Alexander Borsuk <me@alex.bio>
19 lines
329 B
C++
19 lines
329 B
C++
#include "indexer/feature_impl.hpp"
|
|
|
|
#include "base/math.hpp"
|
|
|
|
namespace feature
|
|
{
|
|
|
|
uint8_t PopulationToRank(uint64_t p)
|
|
{
|
|
return static_cast<uint8_t>(std::min(0xFF, math::SignedRound(log(double(p)) / log(1.1))));
|
|
}
|
|
|
|
uint64_t RankToPopulation(uint8_t r)
|
|
{
|
|
return static_cast<uint64_t>(pow(1.1, r));
|
|
}
|
|
|
|
} // namespace feature
|