| 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 import "dart:_internal" hide Symbol; | 5 import "dart:_internal" hide Symbol; |
| 6 import "dart:collection" show ListBase; | 6 import "dart:collection" show ListBase; |
| 7 import 'dart:math' show Random; | 7 import 'dart:math' show Random; |
| 8 | 8 |
| 9 @patch | 9 @patch |
| 10 class ByteData implements TypedData { | 10 class ByteData implements TypedData { |
| (...skipping 3026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3037 } | 3037 } |
| 3038 | 3038 |
| 3039 int _toInt32(int value) { | 3039 int _toInt32(int value) { |
| 3040 return _toInt(value, 0xFFFFFFFF); | 3040 return _toInt(value, 0xFFFFFFFF); |
| 3041 } | 3041 } |
| 3042 | 3042 |
| 3043 int _toUint32(int value) { | 3043 int _toUint32(int value) { |
| 3044 return value & 0xFFFFFFFF; | 3044 return value & 0xFFFFFFFF; |
| 3045 } | 3045 } |
| 3046 | 3046 |
| 3047 // Note: in --limit-ints-to-64-bits mode all integers are 64-bit already. |
| 3048 // Still, it is harmless to apply _uint64Mask because (1 << 64) is 0 (all bits |
| 3049 // are shifted out), so _uint64Mask is -1 (its bit pattern is 0xffffffffffffffff
). |
| 3047 const _uint64Mask = (1 << 64) - 1; | 3050 const _uint64Mask = (1 << 64) - 1; |
| 3048 | 3051 |
| 3049 int _toInt64(int value) { | 3052 int _toInt64(int value) { |
| 3050 // Avoid bigint mask when possible. | 3053 // Avoid bigint mask when possible. |
| 3051 return (ClassID.getID(value) == ClassID.cidBigint) | 3054 return (ClassID.getID(value) == ClassID.cidBigint) |
| 3052 ? _toInt(value, _uint64Mask) | 3055 ? _toInt(value, _uint64Mask) |
| 3053 : value; | 3056 : value; |
| 3054 } | 3057 } |
| 3055 | 3058 |
| 3056 int _toUint64(int value) { | 3059 int _toUint64(int value) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3078 'BYTES_PER_ELEMENT ($alignment)'); | 3081 'BYTES_PER_ELEMENT ($alignment)'); |
| 3079 } | 3082 } |
| 3080 } | 3083 } |
| 3081 | 3084 |
| 3082 int _defaultIfNull(object, value) { | 3085 int _defaultIfNull(object, value) { |
| 3083 if (object == null) { | 3086 if (object == null) { |
| 3084 return value; | 3087 return value; |
| 3085 } | 3088 } |
| 3086 return object; | 3089 return object; |
| 3087 } | 3090 } |
| OLD | NEW |