Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // patch classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
| 6 | 6 |
| 7 import "dart:_internal"; | 7 import "dart:_internal"; |
| 8 import 'dart:math' show Random; | 8 import 'dart:math' show Random; |
| 9 | 9 |
| 10 patch class Int8List { | 10 patch class Int8List { |
| (...skipping 3570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3581 return _toInt(value, 0xFFFFFFFF); | 3581 return _toInt(value, 0xFFFFFFFF); |
| 3582 } | 3582 } |
| 3583 | 3583 |
| 3584 | 3584 |
| 3585 int _toUint32(int value) { | 3585 int _toUint32(int value) { |
| 3586 return value & 0xFFFFFFFF; | 3586 return value & 0xFFFFFFFF; |
| 3587 } | 3587 } |
| 3588 | 3588 |
| 3589 | 3589 |
| 3590 int _toInt64(int value) { | 3590 int _toInt64(int value) { |
| 3591 return _toInt(value, 0xFFFFFFFFFFFFFFFF); // TODO(regis): Avoid bigint mask. | 3591 // Avoid bigint mask when possible. |
| 3592 var cid = ClassID.getID(value); | |
| 3593 if (cid == ClassID.cidSmi || cid == ClassID.cidMint) { | |
|
srdjan
2015/02/11 20:40:06
Please add parentheses.
Maybe instead of two tests
regis
2015/02/11 20:51:17
Done.
| |
| 3594 return value; | |
| 3595 } | |
| 3596 return _toInt(value, 0xFFFFFFFFFFFFFFFF); | |
| 3592 } | 3597 } |
| 3593 | 3598 |
| 3594 | 3599 |
| 3595 int _toUint64(int value) { | 3600 int _toUint64(int value) { |
| 3596 return value & 0xFFFFFFFFFFFFFFFF; // TODO(regis): Avoid bigint mask. | 3601 // Avoid bigint mask when possible. |
| 3602 var cid = ClassID.getID(value); | |
| 3603 if (cid == ClassID.cidSmi || cid == ClassID.cidMint) { | |
|
srdjan
2015/02/11 20:40:06
ditto
regis
2015/02/11 20:51:17
Done.
| |
| 3604 return value; | |
| 3605 } | |
| 3606 return _toInt(value, 0xFFFFFFFFFFFFFFFF); | |
| 3597 } | 3607 } |
| 3598 | 3608 |
| 3599 | 3609 |
| 3600 void _rangeCheck(int listLength, int start, int length) { | 3610 void _rangeCheck(int listLength, int start, int length) { |
| 3601 if (length < 0) { | 3611 if (length < 0) { |
| 3602 throw new RangeError.value(length); | 3612 throw new RangeError.value(length); |
| 3603 } | 3613 } |
| 3604 if (start < 0) { | 3614 if (start < 0) { |
| 3605 throw new RangeError.value(start); | 3615 throw new RangeError.value(start); |
| 3606 } | 3616 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 3623 return value; | 3633 return value; |
| 3624 } | 3634 } |
| 3625 return object; | 3635 return object; |
| 3626 } | 3636 } |
| 3627 | 3637 |
| 3628 | 3638 |
| 3629 _newRangeError(int index, int length) { | 3639 _newRangeError(int index, int length) { |
| 3630 String message = "$index must be in the range [0..$length)"; | 3640 String message = "$index must be in the range [0..$length)"; |
| 3631 return new RangeError(message); | 3641 return new RangeError(message); |
| 3632 } | 3642 } |
| OLD | NEW |