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

Side by Side Diff: lib/src/int32.dart

Issue 1963283002: Fix parameter types for compareTo(). (Closed) Base URL: https://github.com/dart-lang/fixnum@master
Patch Set: Created 4 years, 7 months 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 | « CHANGELOG.md ('k') | lib/src/int64.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 part of fixnum; 5 part of fixnum;
6 6
7 /** 7 /**
8 * An immutable 32-bit signed integer, in the range [-2^31, 2^31 - 1]. 8 * An immutable 32-bit signed integer, in the range [-2^31, 2^31 - 1].
9 * Arithmetic operations may overflow in order to maintain this range. 9 * Arithmetic operations may overflow in order to maintain this range.
10 */ 10 */
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 if (other is Int32) { 280 if (other is Int32) {
281 return _i == other._i; 281 return _i == other._i;
282 } else if (other is Int64) { 282 } else if (other is Int64) {
283 return this.toInt64() == other; 283 return this.toInt64() == other;
284 } else if (other is int) { 284 } else if (other is int) {
285 return _i == other; 285 return _i == other;
286 } 286 }
287 return false; 287 return false;
288 } 288 }
289 289
290 int compareTo(Comparable other) { 290 int compareTo(other) {
291 if (other is Int64) { 291 if (other is Int64) {
292 return this.toInt64().compareTo(other); 292 return this.toInt64().compareTo(other);
293 } 293 }
294 return _i.compareTo(_toInt(other)); 294 return _i.compareTo(_toInt(other));
295 } 295 }
296 296
297 bool operator <(other) { 297 bool operator <(other) {
298 if (other is Int64) { 298 if (other is Int64) {
299 return this.toInt64() < other; 299 return this.toInt64() < other;
300 } 300 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 double toDouble() => _i.toDouble(); 372 double toDouble() => _i.toDouble();
373 int toInt() => _i; 373 int toInt() => _i;
374 Int32 toInt32() => this; 374 Int32 toInt32() => this;
375 Int64 toInt64() => new Int64(_i); 375 Int64 toInt64() => new Int64(_i);
376 376
377 String toString() => _i.toString(); 377 String toString() => _i.toString();
378 String toHexString() => _i.toRadixString(16); 378 String toHexString() => _i.toRadixString(16);
379 String toRadixString(int radix) => _i.toRadixString(radix); 379 String toRadixString(int radix) => _i.toRadixString(radix);
380 } 380 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/int64.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698