V8 Project
|
#include <bignum.h>
Public Member Functions | |
Bignum () | |
void | AssignUInt16 (uint16_t value) |
void | AssignUInt64 (uint64_t value) |
void | AssignBignum (const Bignum &other) |
void | AssignDecimalString (Vector< const char > value) |
void | AssignHexString (Vector< const char > value) |
void | AssignPowerUInt16 (uint16_t base, int exponent) |
void | AddUInt16 (uint16_t operand) |
void | AddUInt64 (uint64_t operand) |
void | AddBignum (const Bignum &other) |
void | SubtractBignum (const Bignum &other) |
void | Square () |
void | ShiftLeft (int shift_amount) |
void | MultiplyByUInt32 (uint32_t factor) |
void | MultiplyByUInt64 (uint64_t factor) |
void | MultiplyByPowerOfTen (int exponent) |
void | Times10 () |
uint16_t | DivideModuloIntBignum (const Bignum &other) |
bool | ToHexString (char *buffer, int buffer_size) const |
Static Public Member Functions | |
static int | Compare (const Bignum &a, const Bignum &b) |
static bool | Equal (const Bignum &a, const Bignum &b) |
static bool | LessEqual (const Bignum &a, const Bignum &b) |
static bool | Less (const Bignum &a, const Bignum &b) |
static int | PlusCompare (const Bignum &a, const Bignum &b, const Bignum &c) |
static bool | PlusEqual (const Bignum &a, const Bignum &b, const Bignum &c) |
static bool | PlusLessEqual (const Bignum &a, const Bignum &b, const Bignum &c) |
static bool | PlusLess (const Bignum &a, const Bignum &b, const Bignum &c) |
Static Public Attributes | |
static const int | kMaxSignificantBits = 3584 |
Private Types | |
typedef uint32_t | Chunk |
typedef uint64_t | DoubleChunk |
Private Member Functions | |
void | EnsureCapacity (int size) |
void | Align (const Bignum &other) |
void | Clamp () |
bool | IsClamped () const |
void | Zero () |
void | BigitsShiftLeft (int shift_amount) |
int | BigitLength () const |
Chunk | BigitAt (int index) const |
void | SubtractTimes (const Bignum &other, int factor) |
DISALLOW_COPY_AND_ASSIGN (Bignum) | |
Private Attributes | |
Chunk | bigits_buffer_ [kBigitCapacity] |
Vector< Chunk > | bigits_ |
int | used_digits_ |
int | exponent_ |
Static Private Attributes | |
static const int | kChunkSize = sizeof(Chunk) * 8 |
static const int | kDoubleChunkSize = sizeof(DoubleChunk) * 8 |
static const int | kBigitSize = 28 |
static const Chunk | kBigitMask = (1 << kBigitSize) - 1 |
static const int | kBigitCapacity = kMaxSignificantBits / kBigitSize |
|
private |
|
private |
v8::internal::Bignum::Bignum | ( | ) |
Definition at line 13 of file bignum.cc.
References bigits_, and kBigitCapacity.
void v8::internal::Bignum::AddBignum | ( | const Bignum & | other | ) |
Definition at line 150 of file bignum.cc.
References Align(), BigitLength(), bigits_, v8::internal::carry, DCHECK, EnsureCapacity(), exponent_, IsClamped(), kBigitMask, kBigitSize, v8::internal::Max(), and used_digits_.
Referenced by AddUInt64().
void v8::internal::Bignum::AddUInt16 | ( | uint16_t | operand | ) |
void v8::internal::Bignum::AddUInt64 | ( | uint64_t | operand | ) |
Definition at line 142 of file bignum.cc.
References AddBignum(), and AssignUInt64().
Referenced by AssignDecimalString().
|
private |
Definition at line 676 of file bignum.cc.
References bigits_, DCHECK, EnsureCapacity(), exponent_, and used_digits_.
Referenced by AddBignum(), DivideModuloIntBignum(), and SubtractBignum().
void v8::internal::Bignum::AssignBignum | ( | const Bignum & | other | ) |
Definition at line 56 of file bignum.cc.
References bigits_, exponent_, and used_digits_.
Referenced by v8::internal::FixupMultiply10(), v8::internal::InitialScaledStartValuesNegativeExponentNegativePower(), and SubtractTimes().
void v8::internal::Bignum::AssignDecimalString | ( | Vector< const char > | value | ) |
Definition at line 82 of file bignum.cc.
References AddUInt64(), Clamp(), v8::internal::kMaxUint64DecimalDigits, v8::internal::Vector< T >::length(), MultiplyByPowerOfTen(), v8::internal::ReadUInt64(), and Zero().
Referenced by v8::internal::BignumStrtod().
void v8::internal::Bignum::AssignHexString | ( | Vector< const char > | value | ) |
Definition at line 112 of file bignum.cc.
References bigits_, Clamp(), EnsureCapacity(), v8::internal::HexCharValue(), kBigitSize, v8::internal::Vector< T >::length(), used_digits_, and Zero().
void v8::internal::Bignum::AssignPowerUInt16 | ( | uint16_t | base, |
int | exponent | ||
) |
Definition at line 393 of file bignum.cc.
References AssignUInt16(), AssignUInt64(), DCHECK, EnsureCapacity(), kBigitSize, MultiplyByUInt32(), ShiftLeft(), Square(), and Zero().
Referenced by v8::internal::InitialScaledStartValuesNegativeExponentNegativePower(), v8::internal::InitialScaledStartValuesNegativeExponentPositivePower(), and v8::internal::InitialScaledStartValuesPositiveExponent().
void v8::internal::Bignum::AssignUInt16 | ( | uint16_t | value | ) |
Definition at line 28 of file bignum.cc.
References bigits_, v8::internal::BitSize(), DCHECK, EnsureCapacity(), kBigitSize, used_digits_, and Zero().
Referenced by AssignPowerUInt16(), v8::internal::InitialScaledStartValuesNegativeExponentNegativePower(), v8::internal::InitialScaledStartValuesNegativeExponentPositivePower(), and v8::internal::InitialScaledStartValuesPositiveExponent().
void v8::internal::Bignum::AssignUInt64 | ( | uint64_t | value | ) |
Definition at line 39 of file bignum.cc.
References bigits_, Clamp(), EnsureCapacity(), kBigitMask, kBigitSize, used_digits_, and Zero().
Referenced by AddUInt64(), AssignPowerUInt16(), v8::internal::BignumStrtod(), v8::internal::InitialScaledStartValuesNegativeExponentPositivePower(), and v8::internal::InitialScaledStartValuesPositiveExponent().
|
private |
Definition at line 589 of file bignum.cc.
References BigitLength(), bigits_, and exponent_.
Referenced by Compare(), and PlusCompare().
|
inlineprivate |
Definition at line 101 of file bignum.h.
References exponent_, and used_digits_.
Referenced by AddBignum(), BigitAt(), Compare(), DivideModuloIntBignum(), PlusCompare(), and ToHexString().
|
private |
Definition at line 700 of file bignum.cc.
References bigits_, v8::internal::carry, DCHECK, kBigitMask, kBigitSize, and used_digits_.
Referenced by ShiftLeft().
|
private |
Definition at line 651 of file bignum.cc.
References bigits_, exponent_, and used_digits_.
Referenced by AssignDecimalString(), AssignHexString(), AssignUInt64(), DivideModuloIntBignum(), Square(), SubtractBignum(), and SubtractTimes().
Definition at line 596 of file bignum.cc.
References BigitAt(), BigitLength(), DCHECK, exponent_, IsClamped(), and v8::internal::Min().
Referenced by v8::internal::BignumStrtod(), Equal(), Less(), and LessEqual().
|
private |
uint16_t v8::internal::Bignum::DivideModuloIntBignum | ( | const Bignum & | other | ) |
Definition at line 467 of file bignum.cc.
References Align(), BigitLength(), bigits_, Clamp(), DCHECK, IsClamped(), kBigitSize, LessEqual(), SubtractBignum(), SubtractTimes(), and used_digits_.
Referenced by v8::internal::GenerateCountedDigits(), and v8::internal::GenerateShortestDigits().
|
inlineprivate |
Definition at line 87 of file bignum.h.
References kBigitCapacity, size, and UNREACHABLE.
Referenced by AddBignum(), Align(), AssignHexString(), AssignPowerUInt16(), AssignUInt16(), AssignUInt64(), MultiplyByUInt32(), MultiplyByUInt64(), ShiftLeft(), and Square().
Definition at line 49 of file bignum.h.
References Compare().
Referenced by v8::internal::FixupMultiply10(), v8::internal::GenerateShortestDigits(), and SubtractTimes().
|
private |
Definition at line 662 of file bignum.cc.
References bigits_, and used_digits_.
Referenced by AddBignum(), Compare(), DivideModuloIntBignum(), PlusCompare(), Square(), SubtractBignum(), and ToHexString().
Definition at line 55 of file bignum.h.
References Compare().
Referenced by v8::internal::GenerateShortestDigits().
Definition at line 52 of file bignum.h.
References Compare().
Referenced by DivideModuloIntBignum(), v8::internal::GenerateShortestDigits(), and SubtractBignum().
void v8::internal::Bignum::MultiplyByPowerOfTen | ( | int | exponent | ) |
Definition at line 281 of file bignum.cc.
References DCHECK, MultiplyByUInt32(), MultiplyByUInt64(), ShiftLeft(), used_digits_, and V8_2PART_UINT64_C.
Referenced by AssignDecimalString(), and v8::internal::BignumStrtod().
void v8::internal::Bignum::MultiplyByUInt32 | ( | uint32_t | factor | ) |
Definition at line 228 of file bignum.cc.
References bigits_, v8::internal::carry, DCHECK, EnsureCapacity(), kBigitMask, kBigitSize, kDoubleChunkSize, used_digits_, and Zero().
Referenced by AssignPowerUInt16(), MultiplyByPowerOfTen(), SubtractTimes(), and Times10().
void v8::internal::Bignum::MultiplyByUInt64 | ( | uint64_t | factor | ) |
Definition at line 254 of file bignum.cc.
References bigits_, v8::internal::carry, DCHECK, EnsureCapacity(), kBigitMask, kBigitSize, used_digits_, and Zero().
Referenced by v8::internal::InitialScaledStartValuesNegativeExponentNegativePower(), and MultiplyByPowerOfTen().
|
static |
Definition at line 614 of file bignum.cc.
References BigitAt(), BigitLength(), DCHECK, exponent_, IsClamped(), kBigitSize, and v8::internal::Min().
Referenced by v8::internal::BignumToFixed(), v8::internal::FixupMultiply10(), v8::internal::GenerateCountedDigits(), v8::internal::GenerateShortestDigits(), PlusEqual(), PlusLess(), and PlusLessEqual().
|
inlinestatic |
Definition at line 61 of file bignum.h.
References PlusCompare().
|
inlinestatic |
Definition at line 69 of file bignum.h.
References PlusCompare().
|
inlinestatic |
Definition at line 65 of file bignum.h.
References PlusCompare().
void v8::internal::Bignum::ShiftLeft | ( | int | shift_amount | ) |
Definition at line 219 of file bignum.cc.
References BigitsShiftLeft(), EnsureCapacity(), exponent_, kBigitSize, and used_digits_.
Referenced by AssignPowerUInt16(), v8::internal::BignumStrtod(), v8::internal::InitialScaledStartValuesNegativeExponentNegativePower(), v8::internal::InitialScaledStartValuesNegativeExponentPositivePower(), v8::internal::InitialScaledStartValuesPositiveExponent(), and MultiplyByPowerOfTen().
void v8::internal::Bignum::Square | ( | ) |
Definition at line 321 of file bignum.cc.
References bigits_, Clamp(), DCHECK, EnsureCapacity(), exponent_, IsClamped(), kBigitMask, kBigitSize, kChunkSize, UNIMPLEMENTED, and used_digits_.
Referenced by AssignPowerUInt16().
void v8::internal::Bignum::SubtractBignum | ( | const Bignum & | other | ) |
Definition at line 192 of file bignum.cc.
References Align(), bigits_, Clamp(), DCHECK, exponent_, IsClamped(), kBigitMask, kChunkSize, LessEqual(), and used_digits_.
Referenced by DivideModuloIntBignum(), and SubtractTimes().
Definition at line 716 of file bignum.cc.
References AssignBignum(), bigits_, Clamp(), DCHECK, Equal(), exponent_, kBigitMask, kBigitSize, kChunkSize, MultiplyByUInt32(), SubtractBignum(), and used_digits_.
Referenced by DivideModuloIntBignum().
|
inline |
Definition at line 39 of file bignum.h.
References MultiplyByUInt32().
Referenced by v8::internal::BignumToFixed(), v8::internal::FixupMultiply10(), v8::internal::GenerateCountedDigits(), and v8::internal::GenerateShortestDigits().
Definition at line 549 of file bignum.cc.
References BigitLength(), bigits_, DCHECK, exponent_, v8::internal::HexCharOfValue(), IsClamped(), kBigitSize, v8::internal::SizeInHexChars(), and used_digits_.
|
private |
Definition at line 667 of file bignum.cc.
References bigits_, exponent_, and used_digits_.
Referenced by AssignDecimalString(), AssignHexString(), AssignPowerUInt16(), AssignUInt16(), AssignUInt64(), MultiplyByUInt32(), and MultiplyByUInt64().
Definition at line 108 of file bignum.h.
Referenced by AddBignum(), Align(), AssignBignum(), AssignHexString(), AssignUInt16(), AssignUInt64(), BigitAt(), BigitsShiftLeft(), Bignum(), Clamp(), DivideModuloIntBignum(), IsClamped(), MultiplyByUInt32(), MultiplyByUInt64(), Square(), SubtractBignum(), SubtractTimes(), ToHexString(), and Zero().
|
private |
|
private |
Definition at line 111 of file bignum.h.
Referenced by AddBignum(), Align(), AssignBignum(), BigitAt(), BigitLength(), Clamp(), Compare(), PlusCompare(), ShiftLeft(), Square(), SubtractBignum(), SubtractTimes(), ToHexString(), and Zero().
|
staticprivate |
Definition at line 85 of file bignum.h.
Referenced by Bignum(), and EnsureCapacity().
|
staticprivate |
Definition at line 82 of file bignum.h.
Referenced by AddBignum(), AssignUInt64(), BigitsShiftLeft(), MultiplyByUInt32(), MultiplyByUInt64(), Square(), SubtractBignum(), and SubtractTimes().
|
staticprivate |
Definition at line 81 of file bignum.h.
Referenced by AddBignum(), AssignHexString(), AssignPowerUInt16(), AssignUInt16(), AssignUInt64(), BigitsShiftLeft(), DivideModuloIntBignum(), MultiplyByUInt32(), MultiplyByUInt64(), PlusCompare(), ShiftLeft(), Square(), SubtractTimes(), and ToHexString().
Definition at line 77 of file bignum.h.
Referenced by Square(), SubtractBignum(), and SubtractTimes().
|
staticprivate |
Definition at line 78 of file bignum.h.
Referenced by MultiplyByUInt32().
|
static |
Definition at line 16 of file bignum.h.
Referenced by v8::internal::BignumDtoa(), and v8::internal::BignumStrtod().
|
private |
Definition at line 109 of file bignum.h.
Referenced by AddBignum(), Align(), AssignBignum(), AssignHexString(), AssignUInt16(), AssignUInt64(), BigitLength(), BigitsShiftLeft(), Clamp(), DivideModuloIntBignum(), IsClamped(), MultiplyByPowerOfTen(), MultiplyByUInt32(), MultiplyByUInt64(), ShiftLeft(), Square(), SubtractBignum(), SubtractTimes(), ToHexString(), and Zero().