From a25bc71f3faf3f7ca4de9eda6342503768bf28ad Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 20 Oct 2020 14:16:09 +0200 Subject: Make Blockchain::get_fee_quantization_mask() compile time This also removes potential thread safety bug in that function. --- src/common/powerof.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/common/powerof.h (limited to 'src/common') diff --git a/src/common/powerof.h b/src/common/powerof.h new file mode 100644 index 000000000..0f6c6254a --- /dev/null +++ b/src/common/powerof.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +namespace tools +{ + template + struct PowerOf + { + enum Data : uint64_t + { + // a^b = a * a^(b-1) + Value = a * PowerOf::Value, + }; + }; + + template + struct PowerOf + { + enum Data : uint64_t + { + // a^0 = 1 + Value = 1, + }; + }; +} -- cgit v1.2.3