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

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: Addressed review comments from asiva@ 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
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cf1c7b07b9588138c2c952989bb8ed45a042579d 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1177,8 +1177,19 @@ 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');
+ if (neg) {
+ writer->WriteIntptrValue(len - 1); // Include '-' in length.
+ writer->Write<uint8_t>('-');
+ } else {
+ writer->WriteIntptrValue(len - 2);
+ }
for (intptr_t i = 2; i < len; i++) {
writer->Write<uint8_t>(str[i]);
}
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698