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

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

Issue 1422753004: VM: Add double unary minus intrinsic. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/vm/intrinsifier.cc » ('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 extends _Num implements double { 5 class _Double extends _Num 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; 9 Type get runtimeType => double;
10 10
(...skipping 28 matching lines...) Expand all
39 39
40 double operator %(num other) { 40 double operator %(num other) {
41 return _modulo(other.toDouble()); 41 return _modulo(other.toDouble());
42 } 42 }
43 double _modulo(double other) native "Double_modulo"; 43 double _modulo(double other) native "Double_modulo";
44 44
45 double remainder(num other) { 45 double remainder(num other) {
46 return _remainder(other.toDouble()); 46 return _remainder(other.toDouble());
47 } 47 }
48 double _remainder(double other) native "Double_remainder"; 48 double _remainder(double other) native "Double_remainder";
49 double operator -() { 49
50 // Handles properly 0.0, NAN, and other doubles. 50 double operator -() native "Double_flipSignBit";
51 return this._flipSignBit;
52 }
53 double get _flipSignBit native "Double_flipSignBit";
54 51
55 bool operator ==(other) { 52 bool operator ==(other) {
56 if (!(other is num)) return false; 53 if (!(other is num)) return false;
57 return _equal(other.toDouble()); 54 return _equal(other.toDouble());
58 } 55 }
59 bool _equal(double other)native "Double_equal"; 56 bool _equal(double other) native "Double_equal";
60 bool _equalToInteger(int other) native "Double_equalToInteger"; 57 bool _equalToInteger(int other) native "Double_equalToInteger";
61 bool operator <(num other) { 58 bool operator <(num other) {
62 return other > this; 59 return other > this;
63 } 60 }
64 bool operator >(num other) { 61 bool operator >(num other) {
65 return _greaterThan(other.toDouble()); 62 return _greaterThan(other.toDouble());
66 } 63 }
67 bool _greaterThan(double other) native "Double_greaterThan"; 64 bool _greaterThan(double other) native "Double_greaterThan";
68 bool operator >=(num other) { 65 bool operator >=(num other) {
69 return (this == other) || (this > other); 66 return (this == other) || (this > other);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return EQUAL; 260 return EQUAL;
264 } 261 }
265 } else if (isNaN) { 262 } else if (isNaN) {
266 return other.isNaN ? EQUAL : GREATER; 263 return other.isNaN ? EQUAL : GREATER;
267 } else { 264 } else {
268 // Other is NaN. 265 // Other is NaN.
269 return LESS; 266 return LESS;
270 } 267 }
271 } 268 }
272 } 269 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698