Chromium Code Reviews| Index: runtime/lib/bigint.dart |
| diff --git a/runtime/lib/bigint.dart b/runtime/lib/bigint.dart |
| index af03ea41fd62394b676623b0b59d6b2126c524e9..217b6ed027913af46acc604126dda38121701ef3 100644 |
| --- a/runtime/lib/bigint.dart |
| +++ b/runtime/lib/bigint.dart |
| @@ -57,6 +57,10 @@ class _Bigint extends _IntegerImplementation implements int { |
| static const int _DIGIT2_BITS = _DIGIT_BITS >> 1; |
| static const int _DIGIT2_MASK = (1 << _DIGIT2_BITS) - 1; |
| + // Bits per 2 digits |
| + static const int _TWO_DIGITS_BITS = _DIGIT_BITS << 1; |
| + static const int _TWO_DIGITS_MASK = (1 << _TWO_DIGITS_BITS) - 1; |
|
regis
2017/07/17 16:45:31
How is this supposed to work? Do you avoid the cre
alexmarkov
2017/07/17 20:21:28
Done.
|
| + |
| // Min and max of non bigint values. |
| static const int _MIN_INT64 = (-1) << 63; |
| static const int _MAX_INT64 = 0x7fffffffffffffff; |
| @@ -1932,7 +1936,8 @@ class _Montgomery implements _Reduction { |
| 0xffff; // y == 1/x mod 2^16 |
| y = (y * (2 - ((xl * y) & 0xffffffff))) & 0xffffffff; // y == 1/x mod 2^32 |
| var x = (args[_X_HI] << _Bigint._DIGIT_BITS) | xl; |
| - y = (y * (2 - ((x * y) & 0xffffffffffffffff))) & 0xffffffffffffffff; |
| + y = (y * (2 - ((x * y) & _Bigint._TWO_DIGITS_MASK))) & |
| + _Bigint._TWO_DIGITS_MASK; |
| // y == 1/x mod _DIGIT_BASE^2 |
| y = -y; // We really want the negative inverse. |
| args[_RHO] = y & _Bigint._DIGIT_MASK; |