#include "MathUtils.h" namespace bts { template inline constexpr uint32_t MathUtils::factorial() { return N * factorial(); } template <> inline constexpr uint32_t MathUtils::factorial<0>() { return 1; } template inline constexpr uint32_t MathUtils::choose() { // This actually involves more multiplication ops than the non-constexpr // overload of 'choose.' The former performs N-A multiplications (the minimum // possible), while the latter (this method) performs 'N + (N-A) + A = 2N' // multiplications return factorial() / (factorial() * factorial()); } } // namespace bts