OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // TODO(srdjan): fix limitations. | 5 // TODO(srdjan): fix limitations. |
6 // - shift amount must be a Smi. | 6 // - shift amount must be a Smi. |
7 class _IntegerImplementation { | 7 class _IntegerImplementation { |
8 factory _IntegerImplementation._uninstantiable() { | 8 factory _IntegerImplementation._uninstantiable() { |
9 throw new UnsupportedError( | 9 throw new UnsupportedError( |
10 "_IntegerImplementation can only be allocated by the VM"); | 10 "_IntegerImplementation can only be allocated by the VM"); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 _OneByteString string = _OneByteString._allocate(index); | 283 _OneByteString string = _OneByteString._allocate(index); |
284 for (int i = 0, j = index; i < index; i++) { | 284 for (int i = 0, j = index; i < index; i++) { |
285 string._setAt(i, reversed[--j]); | 285 string._setAt(i, reversed[--j]); |
286 } | 286 } |
287 return string; | 287 return string; |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 // Reusable buffer used by smi.toString. | 291 // Reusable buffer used by smi.toString. |
292 List _toStringBuffer = new Uint8List(20); | 292 final List _toStringBuffer = new Uint8List(20); |
293 | 293 |
294 // Represents integers that cannot be represented by Smi but fit into 64bits. | 294 // Represents integers that cannot be represented by Smi but fit into 64bits. |
295 class _Mint extends _IntegerImplementation implements int { | 295 class _Mint extends _IntegerImplementation implements int { |
296 factory _Mint._uninstantiable() { | 296 factory _Mint._uninstantiable() { |
297 throw new UnsupportedError( | 297 throw new UnsupportedError( |
298 "_Mint can only be allocated by the VM"); | 298 "_Mint can only be allocated by the VM"); |
299 } | 299 } |
300 int get _identityHashCode { | 300 int get _identityHashCode { |
301 return this; | 301 return this; |
302 } | 302 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } else { | 334 } else { |
335 return 0; | 335 return 0; |
336 } | 336 } |
337 } | 337 } |
338 int _shlFromInt(int other) native "Bigint_shlFromInt"; | 338 int _shlFromInt(int other) native "Bigint_shlFromInt"; |
339 | 339 |
340 int pow(int exponent) { | 340 int pow(int exponent) { |
341 throw "Bigint.pow not implemented"; | 341 throw "Bigint.pow not implemented"; |
342 } | 342 } |
343 } | 343 } |
OLD | NEW |