| Index: runtime/vm/bigint_operations.cc
|
| ===================================================================
|
| --- runtime/vm/bigint_operations.cc (revision 13822)
|
| +++ runtime/vm/bigint_operations.cc (working copy)
|
| @@ -776,9 +776,17 @@
|
|
|
| RawBigint* BigintOperations::Modulo(const Bigint& a, const Bigint& b) {
|
| Bigint& quotient = Bigint::Handle();
|
| - Bigint& modulo = Bigint::Handle();
|
| - DivideRemainder(a, b, "ient, &modulo);
|
| - return modulo.raw();
|
| + Bigint& remainder = Bigint::Handle();
|
| + DivideRemainder(a, b, "ient, &remainder);
|
| + // Emulating code in Integer::ArithmeticOp (Euclidian modulo).
|
| + if (remainder.IsNegative()) {
|
| + if (b.IsNegative()) {
|
| + return BigintOperations::Subtract(remainder, b);
|
| + } else {
|
| + return BigintOperations::Add(remainder, b);
|
| + }
|
| + }
|
| + return remainder.raw();
|
| }
|
|
|
|
|
|
|