From 12b01693187b742d2a545b1f2349a5bde1c1881d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 27 Dec 2019 14:10:02 +0100 Subject: [PATCH] circumvent compiler bug --- util.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util.cpp b/util.cpp index 3ca261ed..aa67dc5e 100644 --- a/util.cpp +++ b/util.cpp @@ -426,7 +426,10 @@ bignum bignum::randomized_div(int x) const { for(int i=K-1; i>=0; i--) { carry *= BASE; carry += digits[i]; - tie(carry, res.digits[i]) = make_pair(carry % x, carry / x); + // strange compiler buug: + // if I do / and %, function 'divmod' is called, and it complains on launch that divmod is unimplemented + res.digits[i] = carry / x; + carry -= res.digits[i] * x; } while(isize(res.digits) && res.digits.back() == 0) res.digits.pop_back(); if(rand() % x < carry) res += 1;