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

Unified Diff: runtime/vm/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/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 016465ab74358eeb10683528c0766a82c18607a7..13511a2fd3435a96ef50a264342b44cb27976043 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include <openssl/crypto.h>
+
#include "vm/snapshot.h"
#include "platform/assert.h"
@@ -539,6 +541,23 @@ void MessageWriter::WriteCObject(Dart_CObject* object) {
WriteSmi(object->value.as_int32);
break;
}
+ case Dart_CObject::kBigint: {
+ // Write out the serialization header value for this object.
+ WriteInlinedHeader(object);
+ // Write out the class and tags information.
+ WriteObjectHeader(ObjectStore::kBigintClass, 0);
+ BIGNUM* bn = BN_new();
+ BN_dec2bn(&bn, object->value.as_bigint);
+ char* hex_string = BN_bn2hex(bn);
siva 2012/02/09 01:47:27 Somebody came up with the BigintOperations class i
Søren Gjesse 2012/02/09 14:08:33 After changing to using the hex format for the dat
+ intptr_t len = strlen(hex_string);
+ WriteIntptrValue(len);
+ for (intptr_t i = 0; i < len; i++) {
+ Write<uint8_t>(hex_string[i]);
+ }
+ OPENSSL_free(hex_string);
+ BN_free(bn);
+ break;
+ }
case Dart_CObject::kDouble:
// Write out the serialization header value for this object.
WriteInlinedHeader(object);

Powered by Google App Engine
This is Rietveld 408576698