28#ifndef DOUBLE_CONVERSION_DIY_FP_H_
29#define DOUBLE_CONVERSION_DIY_FP_H_
46 DiyFp(
const uint64_t significand,
const int32_t exponent) : f_(significand), e_(exponent) {}
73 const uint64_t kM32 = 0xFFFFFFFFU;
74 const uint64_t a = f_ >> 32;
75 const uint64_t b = f_ & kM32;
76 const uint64_t c = other.f_ >> 32;
77 const uint64_t d = other.f_ & kM32;
78 const uint64_t ac = a * c;
79 const uint64_t bc = b * c;
80 const uint64_t ad = a * d;
81 const uint64_t bd = b * d;
84 const uint64_t tmp = (bd >> 32) + (ad & kM32) + (bc & kM32) + (1U << 31);
86 f_ = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
98 uint64_t significand = f_;
99 int32_t exponent = e_;
104 while ((significand & k10MSBits) == 0) {
108 while ((significand & kUint64MSB) == 0) {
122 uint64_t
f()
const {
return f_; }
123 int32_t
e()
const {
return e_; }
125 void set_f(uint64_t new_value) { f_ = new_value; }
126 void set_e(int32_t new_value) { e_ = new_value; }
void set_f(uint64_t new_value)
Definition diy-fp.h:125
uint64_t f() const
Definition diy-fp.h:122
static DiyFp Normalize(const DiyFp &a)
Definition diy-fp.h:116
DiyFp()
Definition diy-fp.h:45
static const int kSignificandSize
Definition diy-fp.h:43
void Normalize()
Definition diy-fp.h:96
void set_e(int32_t new_value)
Definition diy-fp.h:126
int32_t e() const
Definition diy-fp.h:123
static DiyFp Minus(const DiyFp &a, const DiyFp &b)
Definition diy-fp.h:61
DiyFp(const uint64_t significand, const int32_t exponent)
Definition diy-fp.h:46
void Subtract(const DiyFp &other)
Definition diy-fp.h:52
void Multiply(const DiyFp &other)
Definition diy-fp.h:68
static DiyFp Times(const DiyFp &a, const DiyFp &b)
Definition diy-fp.h:90
#define DOUBLE_CONVERSION_ASSERT(condition)
Definition utils.h:46
#define DOUBLE_CONVERSION_UINT64_2PART_C(a, b)
Definition utils.h:195