| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Copyright 2009 The Go Authors. All rights reserved. | 5 // Copyright 2009 The Go Authors. All rights reserved. |
| 6 // Use of this source code is governed by a BSD-style | 6 // Use of this source code is governed by a BSD-style |
| 7 // license that can be found in the LICENSE file. | 7 // license that can be found in the LICENSE file. |
| 8 | 8 |
| 9 /* | 9 /* |
| 10 * Copyright (c) 2003-2005 Tom Wu | 10 * Copyright (c) 2003-2005 Tom Wu |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 874 } |
| 875 while (--j >= 0) { | 875 while (--j >= 0) { |
| 876 // Estimate quotient digit. | 876 // Estimate quotient digit. |
| 877 var qd; | 877 var qd; |
| 878 if (r._digits[--i] == y0) { | 878 if (r._digits[--i] == y0) { |
| 879 qd = DIGIT_MASK; | 879 qd = DIGIT_MASK; |
| 880 } else { | 880 } else { |
| 881 // Chop off one bit, since a Mint cannot hold 2 DIGITs. | 881 // Chop off one bit, since a Mint cannot hold 2 DIGITs. |
| 882 qd = ((r._digits[i] << (DIGIT_BITS - 1)) | | 882 qd = ((r._digits[i] << (DIGIT_BITS - 1)) | |
| 883 (r._digits[i - 1] >> 1)) ~/ yt; | 883 (r._digits[i - 1] >> 1)) ~/ yt; |
| 884 if (qd > DIGIT_MASK) { | |
| 885 qd = DIGIT_MASK; | |
| 886 } | |
| 887 } | 884 } |
| 888 if ((r._digits[i] += y._am(0, qd, r, j, y_used)) < qd) { // Try it out. | 885 if ((r._digits[i] += y._am(0, qd, r, j, y_used)) < qd) { // Try it out. |
| 889 y._dlShiftTo(j, t); | 886 y._dlShiftTo(j, t); |
| 890 r._subTo(t, r); | 887 r._subTo(t, r); |
| 891 while (r._digits[i] < --qd) { | 888 while (r._digits[i] < --qd) { |
| 892 r._subTo(t, r); | 889 r._subTo(t, r); |
| 893 } | 890 } |
| 894 } | 891 } |
| 895 } | 892 } |
| 896 if (q != null) { | 893 if (q != null) { |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 void _sqrTo(_Bigint x, _Bigint r) { | 1342 void _sqrTo(_Bigint x, _Bigint r) { |
| 1346 x._sqrTo(r); | 1343 x._sqrTo(r); |
| 1347 _reduce(r); | 1344 _reduce(r); |
| 1348 } | 1345 } |
| 1349 | 1346 |
| 1350 void _mulTo(_Bigint x, _Bigint y, _Bigint r) { | 1347 void _mulTo(_Bigint x, _Bigint y, _Bigint r) { |
| 1351 x._mulTo(y, r); | 1348 x._mulTo(y, r); |
| 1352 _reduce(r); | 1349 _reduce(r); |
| 1353 } | 1350 } |
| 1354 } | 1351 } |
| OLD | NEW |