From cc86a0724a7d4160b9d6c18250701207f4db4ed9 Mon Sep 17 00:00:00 2001 From: OmicronTau Date: Wed, 15 Sep 2021 18:08:39 +0300 Subject: [PATCH] Fix muldivmod --- crypto/common/bigint.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/common/bigint.hpp b/crypto/common/bigint.hpp index 07ccc7d1..e78f4892 100644 --- a/crypto/common/bigint.hpp +++ b/crypto/common/bigint.hpp @@ -1312,7 +1312,10 @@ bool AnyIntView::mod_div_any(const AnyIntView& yp, AnyIntView& quot, if (k > quot.max_size()) { return invalidate_bool(); } - quot.set_size(k); + quot.set_size(max(k,1)); + for(int qi=0; qi< max(k,1); qi++) { + quot.digits[qi]=0; + } } else { if (k >= quot.max_size()) { return invalidate_bool();