| Index: Source/wtf/dtoa/diy-fp.h
|
| diff --git a/Source/wtf/dtoa/diy-fp.h b/Source/wtf/dtoa/diy-fp.h
|
| index e843100a82aa34a628dcee8c2711f9ac50ef9e69..f6415428975f387c016d1ccadf6792d054d4ef3a 100644
|
| --- a/Source/wtf/dtoa/diy-fp.h
|
| +++ b/Source/wtf/dtoa/diy-fp.h
|
| @@ -33,7 +33,7 @@
|
| namespace WTF {
|
|
|
| namespace double_conversion {
|
| -
|
| +
|
| // This "Do It Yourself Floating Point" class implements a floating-point number
|
| // with a uint64 significand and an int exponent. Normalized DiyFp numbers will
|
| // have the most significant bit of the significand set.
|
| @@ -42,10 +42,10 @@ namespace double_conversion {
|
| class DiyFp {
|
| public:
|
| static const int kSignificandSize = 64;
|
| -
|
| +
|
| DiyFp() : f_(0), e_(0) {}
|
| DiyFp(uint64_t f, int e) : f_(f), e_(e) {}
|
| -
|
| +
|
| // this = this - other.
|
| // The exponents of both numbers must be the same and the significand of this
|
| // must be bigger than the significand of other.
|
| @@ -55,7 +55,7 @@ namespace double_conversion {
|
| ASSERT(f_ >= other.f_);
|
| f_ -= other.f_;
|
| }
|
| -
|
| +
|
| // Returns a - b.
|
| // The exponents of both numbers must be the same and this must be bigger
|
| // than other. The result will not be normalized.
|
| @@ -64,23 +64,23 @@ namespace double_conversion {
|
| result.Subtract(b);
|
| return result;
|
| }
|
| -
|
| -
|
| +
|
| +
|
| // this = this * other.
|
| void Multiply(const DiyFp& other);
|
| -
|
| +
|
| // returns a * b;
|
| static DiyFp Times(const DiyFp& a, const DiyFp& b) {
|
| DiyFp result = a;
|
| result.Multiply(b);
|
| return result;
|
| }
|
| -
|
| +
|
| void Normalize() {
|
| ASSERT(f_ != 0);
|
| uint64_t f = f_;
|
| int e = e_;
|
| -
|
| +
|
| // This method is mainly called for normalizing boundaries. In general
|
| // boundaries need to be shifted by 10 bits. We thus optimize for this case.
|
| const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000);
|
| @@ -95,26 +95,26 @@ namespace double_conversion {
|
| f_ = f;
|
| e_ = e;
|
| }
|
| -
|
| +
|
| static DiyFp Normalize(const DiyFp& a) {
|
| DiyFp result = a;
|
| result.Normalize();
|
| return result;
|
| }
|
| -
|
| +
|
| uint64_t f() const { return f_; }
|
| int e() const { return e_; }
|
| -
|
| +
|
| void set_f(uint64_t new_value) { f_ = new_value; }
|
| void set_e(int new_value) { e_ = new_value; }
|
| -
|
| +
|
| private:
|
| static const uint64_t kUint64MSB = UINT64_2PART_C(0x80000000, 00000000);
|
| -
|
| +
|
| uint64_t f_;
|
| int e_;
|
| };
|
| -
|
| +
|
| } // namespace double_conversion
|
|
|
| } // namespace WTF
|
|
|