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

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: 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..0de6a96633a7ba039319c2e70855944a12eff303 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -390,8 +390,11 @@ 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 = 0;
kasperl 2012/03/07 12:47:01 intptr_t part = (remainder.Length() == 1) ? sta
floitsch 2012/03/07 12:51:26 Done.
+ if (remainder.Length() == 1) {
+ part = static_cast<intptr_t>(remainder.GetChunkAt(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