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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 9363023: Add support for big integers to the native message format (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 7b515c5742bb93746fc763cf0a723c13f9979ee9..5aeac65760eb84d57cce653246eb8d681d00ead2 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1177,8 +1177,15 @@ void RawBigint::WriteTo(SnapshotWriter* writer,
// Write out the bigint value as a HEXCstring.
ptr()->bn_.d = ptr()->data_;
const char* str = BigintOperations::ToHexCString(&ptr()->bn_, &ZoneAllocator);
+ bool neg = false;
+ if (*str == '-') {
+ neg = true;
+ str++;
+ }
intptr_t len = strlen(str);
- writer->WriteIntptrValue(len-2);
+ ASSERT(len > 2 && str[0] == '0' && str[1] == 'x');
+ writer->WriteIntptrValue(len - 2 + (neg ? 1 : 0));
+ if (neg) writer->Write<uint8_t>('-');
siva 2012/02/09 01:47:27 Could you restruct as follows to make it more clea
Søren Gjesse 2012/02/09 14:08:33 Done.
for (intptr_t i = 2; i < len; i++) {
writer->Write<uint8_t>(str[i]);
}

Powered by Google App Engine
This is Rietveld 408576698