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

Unified Diff: vm/bigint_operations.h

Issue 9835074: Fix for issue 2233 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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 | vm/bigint_operations.cc » ('j') | vm/bigint_operations.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/bigint_operations.h
===================================================================
--- vm/bigint_operations.h (revision 5763)
+++ vm/bigint_operations.h (working copy)
@@ -22,12 +22,24 @@
Heap::Space space = Heap::kNew);
static RawBigint* NewFromDouble(double d, Heap::Space space = Heap::kNew);
- // The given string must be a nul-terminated string of hex-digits. It must
- // only contain hex-digits. No sign or leading "0x" is allowed.
- static RawBigint* FromHexCString(const char* str,
+ // Compute length of bigint instance created for the specified hex string.
cshapiro 2012/03/24 01:48:07 What is the unit for this length?
siva 2012/03/24 02:25:03 Changed comment. On 2012/03/24 01:48:07, cshapiro
+ // The specified hex string must be a null-terminated string of hex-digits.
+ // It must only contain hex-digits. Leading "0x" is not allowed.
+ static intptr_t ComputeLength(const char* hex_string);
+
+ // Create a bigint instance from the specified hex string. The given string
+ // must be a null-terminated string of hex-digits. It must only contain
+ // hex-digits. Leading "0x" is not allowed.
+ static RawBigint* FromHexCString(const char* hex_string,
Heap::Space space = Heap::kNew);
- // The given string must be a nul-terminated string of decimal digits. It
+ // Helper method to initialize a bigint instance object with the bigint value
+ // in the specified string. The given string must be a null-terminated string
+ // of hex-digits. It must only contain hex-digits, leading "0x" is not
+ // allowed.
+ static void FromHexCString(const char* hex_string, const Bigint& value);
+
+ // The given string must be a null-terminated string of decimal digits. It
cshapiro 2012/03/24 01:48:07 just an fyi, nul (one 'l') is the name of the asci
siva 2012/03/24 02:25:03 Reverted to nul-terminated. On 2012/03/24 01:48:0
// must only contain decimal digits (0-9). No sign is allowed. Leading
// zeroes are ignored.
static RawBigint* FromDecimalCString(const char* str,
@@ -95,6 +107,7 @@
static const Chunk kDigitMaxValue = kDigitMask;
static const int kChunkSize = sizeof(Chunk);
static const int kChunkBitSize = kChunkSize * kBitsPerByte;
+ static const int kHexCharsPerDigit = kDigitBitSize / 4;
static RawBigint* Zero() { return Bigint::Allocate(0); }
static RawBigint* One() {
« no previous file with comments | « no previous file | vm/bigint_operations.cc » ('j') | vm/bigint_operations.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698