23namespace seqan3::detail
53template <std::
unsigned_
integral
unsigned_t>
54constexpr unsigned_t floor_log2(unsigned_t
const n)
noexcept
87template <std::
unsigned_
integral
unsigned_t>
88constexpr unsigned_t ceil_log2(unsigned_t
const n)
noexcept
91 return (n == 1u) ? 0u : seqan3::detail::floor_log2(n - 1u) + 1u;
120template <
typename base_t, std::
unsigned_
integral exp_t>
122 requires (std::same_as<base_t, uint64_t> || std::same_as<base_t, int64_t>)
124base_t
pow(base_t base, exp_t exp)
131 for (exp_t i = 0; i < exp; ++i)
136 " will result in an " + (std::same_as<base_t, int64_t> ?
"int64_t" :
"uint64_t")};
145 for (; exp; exp >>= 1, base *= base)
146 result *= (exp & 1) ? base : 1;
153template <std::
integral base_t, std::
unsigned_
integral exp_t>
154 requires (std::unsigned_integral<base_t> && !std::same_as<base_t, uint64_t>)
155uint64_t
pow(base_t base, exp_t exp)
157 return pow(
static_cast<uint64_t
>(base), exp);
161template <std::
integral base_t, std::
unsigned_
integral exp_t>
162 requires (!std::unsigned_integral<base_t> && !std::same_as<base_t, int64_t>)
163int64_t
pow(base_t base, exp_t exp)
165 return pow(
static_cast<int64_t
>(base), exp);
169template <
typename base_t,
typename exp_t>
170 requires (!(std::integral<base_t> && std::unsigned_integral<exp_t>))
171auto pow(base_t base, exp_t exp)
The <bit> header from C++20's standard library.
The <concepts> header from C++20's standard library.
constexpr T bit_width(T x) noexcept
If x is not zero, calculates the number of bits needed to store the value x, that is,...
Definition: bit:183
base_t pow(base_t base, exp_t exp)
Computes the value of base raised to the power exp.
Definition: math.hpp:124
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2