Chromium Code Reviews| Index: runtime/lib/typed_data.dart |
| =================================================================== |
| --- runtime/lib/typed_data.dart (revision 43696) |
| +++ runtime/lib/typed_data.dart (working copy) |
| @@ -3588,12 +3588,22 @@ |
| int _toInt64(int value) { |
| - return _toInt(value, 0xFFFFFFFFFFFFFFFF); // TODO(regis): Avoid bigint mask. |
| + // Avoid bigint mask when possible. |
| + var cid = ClassID.getID(value); |
| + 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.
|
| + return value; |
| + } |
| + return _toInt(value, 0xFFFFFFFFFFFFFFFF); |
| } |
| int _toUint64(int value) { |
| - return value & 0xFFFFFFFFFFFFFFFF; // TODO(regis): Avoid bigint mask. |
| + // Avoid bigint mask when possible. |
| + var cid = ClassID.getID(value); |
| + if (cid == ClassID.cidSmi || cid == ClassID.cidMint) { |
|
srdjan
2015/02/11 20:40:06
ditto
regis
2015/02/11 20:51:17
Done.
|
| + return value; |
| + } |
| + return _toInt(value, 0xFFFFFFFFFFFFFFFF); |
| } |