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

Unified Diff: runtime/lib/bigint.dart

Issue 559203003: Fix wrong conversion from double to bigint in overriden operators of new bigint. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/bigint.dart
===================================================================
--- runtime/lib/bigint.dart (revision 40121)
+++ runtime/lib/bigint.dart (working copy)
@@ -950,46 +950,40 @@
// efficiency, but are not necessary for correctness. They shortcut native
// calls that would return null because the receiver is _Bigint.
num operator +(num other) {
- return other._toBigint()._addFromInteger(this);
+ return other._toBigintOrDouble()._addFromInteger(this);
}
num operator -(num other) {
- return other._toBigint()._subFromInteger(this);
+ return other._toBigintOrDouble()._subFromInteger(this);
}
num operator *(num other) {
- return other._toBigint()._mulFromInteger(this);
+ return other._toBigintOrDouble()._mulFromInteger(this);
}
num operator ~/(num other) {
if ((other is int) && (other == 0)) {
throw const IntegerDivisionByZeroException();
}
- return other._toBigint()._truncDivFromInteger(this);
+ return other._toBigintOrDouble()._truncDivFromInteger(this);
}
- num operator /(num other) {
- return this.toDouble() / other.toDouble();
- }
- // TODO(regis): Investigate strange behavior with % double.INFINITY.
- /*
num operator %(num other) {
if ((other is int) && (other == 0)) {
throw const IntegerDivisionByZeroException();
}
- return other._toBigint()._moduloFromInteger(this);
+ return other._toBigintOrDouble()._moduloFromInteger(this);
}
- */
int operator &(int other) {
- return other._toBigint()._bitAndFromInteger(this);
+ return other._toBigintOrDouble()._bitAndFromInteger(this);
}
int operator |(int other) {
- return other._toBigint()._bitOrFromInteger(this);
+ return other._toBigintOrDouble()._bitOrFromInteger(this);
}
int operator ^(int other) {
- return other._toBigint()._bitXorFromInteger(this);
+ return other._toBigintOrDouble()._bitXorFromInteger(this);
}
int operator >>(int other) {
- return other._toBigint()._shrFromInt(this);
+ return other._toBigintOrDouble()._shrFromInt(this);
}
int operator <<(int other) {
- return other._toBigint()._shlFromInt(this);
+ return other._toBigintOrDouble()._shlFromInt(this);
}
// End of operator shortcuts.
« no previous file with comments | « no previous file | runtime/lib/double.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698