20namespace seqan3::detail
50template <std::
unsigned_
integral
unsigned_t>
51constexpr unsigned_t floor_log2(unsigned_t
const n)
noexcept
84template <std::
unsigned_
integral
unsigned_t>
85constexpr unsigned_t ceil_log2(unsigned_t
const n)
noexcept
88 return (n == 1u) ? 0u : seqan3::detail::floor_log2(n - 1u) + 1u;
117template <
typename base_t, std::
unsigned_
integral exp_t>
119base_t
pow(base_t base, exp_t exp)
126 auto check = [base](base_t result)
134 return result < std::numeric_limits<base_t>::max() / base;
138 return base < std::numeric_limits<base_t>::min() / result;
142 for (exp_t i = 0; i < exp; ++i)
147 +
" will result in an "
157 for (; exp; exp >>= 1, base *= base)
158 result *= (exp & 1) ? base : 1;
165template <std::
integral base_t, std::
unsigned_
integral exp_t>
167uint64_t
pow(base_t base, exp_t exp)
169 return pow(
static_cast<uint64_t
>(base), exp);
173template <std::
integral base_t, std::
unsigned_
integral exp_t>
175int64_t
pow(base_t base, exp_t exp)
177 return pow(
static_cast<int64_t
>(base), exp);
181template <
typename base_t,
typename exp_t>
183auto pow(base_t base, exp_t exp)
base_t pow(base_t base, exp_t exp)
Computes the value of base raised to the power exp.
Definition math.hpp:119
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26