1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-23 13:43:19 +00:00

circumvent compiler bug

This commit is contained in:
Zeno Rogue 2019-12-27 14:10:02 +01:00
parent 756b5a6690
commit 12b0169318

View File

@ -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;