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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 if (bx >= _DIGIT_BITS) { | 1329 if (bx >= _DIGIT_BITS) { |
1330 bx -= _DIGIT_BITS; | 1330 bx -= _DIGIT_BITS; |
1331 dx++; | 1331 dx++; |
1332 } | 1332 } |
1333 } | 1333 } |
1334 str._setAt(--cx, _IntegerImplementation._digits.codeUnitAt(ch)); | 1334 str._setAt(--cx, _IntegerImplementation._digits.codeUnitAt(ch)); |
1335 } while (cx > firstcx); | 1335 } while (cx > firstcx); |
1336 return str; | 1336 return str; |
1337 } | 1337 } |
1338 | 1338 |
1339 _leftShiftWithMask32(int count, int mask) { | |
1340 if (_used == 0) return 0; | |
1341 if (count is! _Smi) { | |
1342 _shlFromInt(count); // Throws out of memory exception. | |
1343 } | |
1344 assert(_DIGIT_BITS == 32); // Otherwise this code needs to be revised. | |
1345 if (count > 31) return 0; | |
1346 return (_digits[0] << count) & mask; | |
1347 } | |
1348 | |
1349 int _bitAndFromInteger(int other) { | 1339 int _bitAndFromInteger(int other) { |
1350 return other._toBigint()._and(this)._toValidInt(); | 1340 return other._toBigint()._and(this)._toValidInt(); |
1351 } | 1341 } |
1352 int _bitOrFromInteger(int other) { | 1342 int _bitOrFromInteger(int other) { |
1353 return other._toBigint()._or(this)._toValidInt(); | 1343 return other._toBigint()._or(this)._toValidInt(); |
1354 } | 1344 } |
1355 int _bitXorFromInteger(int other) { | 1345 int _bitXorFromInteger(int other) { |
1356 return other._toBigint()._xor(this)._toValidInt(); | 1346 return other._toBigint()._xor(this)._toValidInt(); |
1357 } | 1347 } |
1358 int _addFromInteger(int other) { | 1348 int _addFromInteger(int other) { |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 | 2080 |
2091 int _mul(Uint32List x_digits, int x_used, | 2081 int _mul(Uint32List x_digits, int x_used, |
2092 Uint32List y_digits, int y_used, | 2082 Uint32List y_digits, int y_used, |
2093 Uint32List r_digits) { | 2083 Uint32List r_digits) { |
2094 var r_used = _Bigint._mulDigits(x_digits, x_used, | 2084 var r_used = _Bigint._mulDigits(x_digits, x_used, |
2095 y_digits, y_used, | 2085 y_digits, y_used, |
2096 r_digits); | 2086 r_digits); |
2097 return _reduce(r_digits, r_used); | 2087 return _reduce(r_digits, r_used); |
2098 } | 2088 } |
2099 } | 2089 } |
OLD | NEW |