19 #ifndef RAPIDJSON_DIYFP_H_ 20 #define RAPIDJSON_DIYFP_H_ 22 #include "../rapidjson.h" 24 #if defined(_MSC_VER) && defined(_M_AMD64) 26 #pragma intrinsic(_BitScanReverse64) 27 #pragma intrinsic(_umul128) 35 RAPIDJSON_DIAG_OFF(effc++)
40 RAPIDJSON_DIAG_OFF(padded)
71 #if defined(_MSC_VER) && defined(_M_AMD64) 77 #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) 78 __extension__
typedef unsigned __int128 uint128;
79 uint128
p =
static_cast<uint128
>(
f) * static_cast<uint128>(rhs.
f);
95 uint64_t tmp = (bd >> 32) + (
ad & M32) + (bc & M32);
97 return DiyFp(ac + (
ad >> 32) + (bc >> 32) + (tmp >> 32),
e + rhs.
e + 64);
102 #if defined(_MSC_VER) && defined(_M_AMD64) 104 _BitScanReverse64(&
index,
f);
106 #elif defined(__GNUC__) && __GNUC__ >= 4 107 int s = __builtin_clzll(
f);
111 while (!(
res.f & (static_cast<uint64_t>(1) << 63))) {
131 DiyFp pl =
DiyFp((
f << 1) + 1,
e - 1).NormalizeBoundary();
133 mi.
f <<= mi.
e - pl.
e;
166 static const uint64_t kCachedPowers_F[] = {
212 static const int16_t kCachedPowers_E[] = {
213 -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980,
214 -954, -927, -901, -874, -847, -821, -794, -768, -741, -715,
215 -688, -661, -635, -608, -582, -555, -529, -502, -475, -449,
216 -422, -396, -369, -343, -316, -289, -263, -236, -210, -183,
217 -157, -130, -103, -77, -50, -24, 3, 30, 56, 83,
218 109, 136, 162, 189, 216, 242, 269, 295, 322, 348,
219 375, 402, 428, 455, 481, 508, 534, 561, 588, 614,
220 641, 667, 694, 720, 747, 774, 800, 827, 853, 880,
221 907, 933, 960, 986, 1013, 1039, 1066
229 double dk = (-61 - e) * 0.30102999566398114 + 347;
230 int k =
static_cast<int>(dk);
234 unsigned index =
static_cast<unsigned>((k >> 3) + 1);
235 *
K = -(-348 +
static_cast<int>(
index << 3));
241 unsigned index = (
static_cast<unsigned>(
exp) + 348u) / 8u;
242 *outExp = -348 +
static_cast<int>(
index) * 8;
252 RAPIDJSON_DIAG_OFF(padded)
258 #endif // RAPIDJSON_DIYFP_H_ uint64_t f
Definition: diyfp.h:160
DiyFp operator-(const DiyFp &rhs) const
Definition: diyfp.h:66
DiyFp()
Definition: diyfp.h:44
DiyFp operator*(const DiyFp &rhs) const
Definition: diyfp.h:70
bool minus
Definition: connect_wiiupro.c:41
DiyFp NormalizeBoundary() const
Definition: diyfp.h:119
static const int kDpDenormalExponent
Definition: diyfp.h:155
GLuint res
Definition: glext.h:10520
GLfloat f
Definition: glext.h:8207
int e
Definition: diyfp.h:161
void NormalizedBoundaries(DiyFp *minus, DiyFp *plus) const
Definition: diyfp.h:130
GLdouble s
Definition: glext.h:6390
DiyFp(uint64_t fp, int exp)
Definition: diyfp.h:46
#define exp(a)
Definition: math.h:32
#define RAPIDJSON_NAMESPACE_END
provide custom rapidjson namespace (closing expression)
Definition: rapidjson.h:119
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
DiyFp GetCachedPowerByIndex(size_t index)
Definition: diyfp.h:164
DiyFp GetCachedPower10(int exp, int *outExp)
Definition: diyfp.h:240
DiyFp Normalize() const
Definition: diyfp.h:101
bool l
Definition: connect_wiiupro.c:37
bool plus
Definition: connect_wiiupro.c:42
static const uint64_t kDpExponentMask
Definition: diyfp.h:156
signed short int16_t
Definition: stdint.h:122
static const int kDiySignificandSize
Definition: diyfp.h:150
Definition: document.h:391
static const uint64_t kDpHiddenBit
Definition: diyfp.h:158
GLfloat GLfloat p
Definition: glext.h:9809
GLuint index
Definition: glext.h:6671
static const uint64_t kDpSignificandMask
Definition: diyfp.h:157
#define RAPIDJSON_NAMESPACE_BEGIN
provide custom rapidjson namespace (opening expression)
Definition: rapidjson.h:116
uint64_t u64
64bit unsigned integer
Definition: gctypes.h:20
DiyFp(double d)
Definition: diyfp.h:48
static const int kDpExponentBias
Definition: diyfp.h:152
static const int kDpSignificandSize
Definition: diyfp.h:151
DiyFp GetCachedPower(int e, int *K)
Definition: diyfp.h:226
Definition: netplay_private.h:956
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:8390
#define RAPIDJSON_UINT64_C2(high32, low32)
Construct a 64-bit literal by a pair of 32-bit integer.
Definition: rapidjson.h:289
static const int kDpMaxExponent
Definition: diyfp.h:153
static const int kDpMinExponent
Definition: diyfp.h:154
static const unsigned char ad[]
Definition: ccm.c:369
unsigned __int64 uint64_t
Definition: stdint.h:136
double ToDouble() const
Definition: diyfp.h:139
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844