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

Unified Diff: runtime/vm/bigint_operations.cc

Issue 9620002: Handle Bigint.toCString when remainder equals 0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 8 years, 9 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/vm/bigint_operations_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bigint_operations.cc
diff --git a/runtime/vm/bigint_operations.cc b/runtime/vm/bigint_operations.cc
index 71b593bdb4b436199afa7116bd5e84bab1b39802..5c633d01061dbf6ed2f193382ad3eb4c32c9cd20 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -390,8 +390,10 @@ const char* BigintOperations::ToDecimalCString(
Bigint& remainder = Bigint::Handle();
while (!rest.IsZero()) {
DivideRemainder(rest, divisor, &quotient, &remainder);
- ASSERT(remainder.Length() == 1);
- intptr_t part = static_cast<intptr_t>(remainder.GetChunkAt(0));
+ ASSERT(remainder.Length() <= 1);
+ intptr_t part = (remainder.Length() == 1)
+ ? static_cast<intptr_t>(remainder.GetChunkAt(0))
+ : 0;
for (int i = 0; i < kPowerOfTen; i++) {
result[result_pos++] = '0' + (part % 10);
part /= 10;
« no previous file with comments | « no previous file | runtime/vm/bigint_operations_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698