Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: runtime/lib/double.dart

Issue 2451893002: Revert "Recognize and optimize a.runtimeType == b.runtimeType pattern." (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/lib/integers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 class _Double implements double { 5 class _Double implements double {
6 factory _Double.fromInteger(int value) 6 factory _Double.fromInteger(int value)
7 native "Double_doubleFromInteger"; 7 native "Double_doubleFromInteger";
8 8
9 Type get runtimeType => double;
10
9 // TODO: Make a stared static method for hashCode and _identityHashCode 11 // TODO: Make a stared static method for hashCode and _identityHashCode
10 // when semantics are corrected as described in: 12 // when semantics are corrected as described in:
11 // https://github.com/dart-lang/sdk/issues/2884 13 // https://github.com/dart-lang/sdk/issues/2884
12 int get hashCode => (isNaN || isInfinite) ? 0 : toInt(); 14 int get hashCode => (isNaN || isInfinite) ? 0 : toInt();
13 int get _identityHashCode => (isNaN || isInfinite) ? 0 : toInt(); 15 int get _identityHashCode => (isNaN || isInfinite) ? 0 : toInt();
14 16
15 double operator +(num other) { 17 double operator +(num other) {
16 return _add(other.toDouble()); 18 return _add(other.toDouble());
17 } 19 }
18 double _add(double other) native "Double_add"; 20 double _add(double other) native "Double_add";
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 278 }
277 } 279 }
278 280
279 static const int _FRACTIONAL_BITS = // Bits to keep after the decimal point. 281 static const int _FRACTIONAL_BITS = // Bits to keep after the decimal point.
280 const int.fromEnvironment("doubleFractionalBits", defaultValue: 20); 282 const int.fromEnvironment("doubleFractionalBits", defaultValue: 20);
281 static const double _BIAS = 1.5 * (1 << (52 - _FRACTIONAL_BITS)); 283 static const double _BIAS = 1.5 * (1 << (52 - _FRACTIONAL_BITS));
282 284
283 // Returns this with only _FRACTIONAL_BITS bits after the decimal point. 285 // Returns this with only _FRACTIONAL_BITS bits after the decimal point.
284 double get p => this + _BIAS - _BIAS; 286 double get p => this + _BIAS - _BIAS;
285 } 287 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/integers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698