You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
353 B
27 lines
353 B
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace tools
|
|
{
|
|
template<uint64_t a, uint64_t b>
|
|
struct PowerOf
|
|
{
|
|
enum Data : uint64_t
|
|
{
|
|
// a^b = a * a^(b-1)
|
|
Value = a * PowerOf<a, b - 1>::Value,
|
|
};
|
|
};
|
|
|
|
template<uint64_t a>
|
|
struct PowerOf<a, 0>
|
|
{
|
|
enum Data : uint64_t
|
|
{
|
|
// a^0 = 1
|
|
Value = 1,
|
|
};
|
|
};
|
|
}
|