mirror of
https://github.com/monero-project/monero.git
synced 2025-08-11 18:00:19 -04:00
Make Blockchain::get_fee_quantization_mask() compile time
This also removes potential thread safety bug in that function.
This commit is contained in:
parent
faedcded39
commit
a25bc71f3f
3 changed files with 31 additions and 14 deletions
26
src/common/powerof.h
Normal file
26
src/common/powerof.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#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,
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue