diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2019-04-18 16:34:35 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2019-04-24 16:12:10 +0800 |
commit | eb5439916dc231175671f9e85be699b3593a76f9 (patch) | |
tree | 9a958cb5099e2d8fb564f97f88daa87791dc1ba9 | |
parent | 2b3835260a7a594214bec51fb46e105634145c31 (diff) | |
download | tangerine-mcl-eb5439916dc231175671f9e85be699b3593a76f9.tar.gz tangerine-mcl-eb5439916dc231175671f9e85be699b3593a76f9.tar.zst tangerine-mcl-eb5439916dc231175671f9e85be699b3593a76f9.zip |
increase buffer size of FixedBuffer
-rw-r--r-- | include/mcl/vint.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/mcl/vint.hpp b/include/mcl/vint.hpp index 8c1a13f..6fe6054 100644 --- a/include/mcl/vint.hpp +++ b/include/mcl/vint.hpp @@ -40,6 +40,13 @@ typedef uint64_t Unit; typedef uint32_t Unit; #endif +template<size_t x> +struct RoundUp { + static const size_t UnitBitSize = sizeof(Unit) * 8; + static const size_t N = (x + UnitBitSize - 1) / UnitBitSize; + static const size_t bit = N * UnitBitSize; +}; + template<class T> void dump(const T *x, size_t n, const char *msg = "") { @@ -1984,7 +1991,7 @@ public: }; #ifdef MCL_VINT_FIXED_BUFFER -typedef VintT<vint::FixedBuffer<mcl::vint::Unit, MCL_MAX_BIT_SIZE * 2> > Vint; +typedef VintT<vint::FixedBuffer<mcl::vint::Unit, vint::RoundUp<MCL_MAX_BIT_SIZE>::bit * 2> > Vint; #else typedef VintT<vint::Buffer<mcl::vint::Unit> > Vint; #endif |