mirror of
https://github.com/monero-project/monero.git
synced 2024-12-22 11:39:28 +00:00
a25bc71f3f
This also removes potential thread safety bug in that function.
26 lines
353 B
C++
26 lines
353 B
C++
#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,
|
|
};
|
|
};
|
|
}
|