aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2019-03-13 15:51:10 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2019-03-13 15:51:10 +0800
commit54f2e8cc85d017945a47629d1986c29c291cf6eb (patch)
tree0a77e2aaa535e154731237e851f9d5a8ee2b0413
parent4ae8bc289c2dde29445cf66621c6c97f8e4fba85 (diff)
downloaddexon-mcl-54f2e8cc85d017945a47629d1986c29c291cf6eb.tar.gz
dexon-mcl-54f2e8cc85d017945a47629d1986c29c291cf6eb.tar.zst
dexon-mcl-54f2e8cc85d017945a47629d1986c29c291cf6eb.zip
increase max size of Vint
-rw-r--r--include/mcl/vint.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/mcl/vint.hpp b/include/mcl/vint.hpp
index 6ace405..b087688 100644
--- a/include/mcl/vint.hpp
+++ b/include/mcl/vint.hpp
@@ -1291,7 +1291,8 @@ public:
*/
void setStr(bool *pb, const char *str, int base = 0)
{
- const size_t maxN = MCL_MAX_BIT_SIZE / (sizeof(MCL_SIZEOF_UNIT) * 8);
+ // allow twice size of MCL_MAX_BIT_SIZE because of multiplication
+ const size_t maxN = (MCL_MAX_BIT_SIZE * 2 + unitBitSize - 1) / unitBitSize;
buf_.alloc(pb, maxN);
if (!*pb) return;
*pb = false;