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() { |