34 #ifndef RYU_D2S_INTRINSICS_H
35 #define RYU_D2S_INTRINSICS_H
37 #if defined(HAS_64_BIT_INTRINSICS)
42 umul128(
const uint64
a,
const uint64
b, uint64 *
const productHi)
44 return _umul128(
a,
b, productHi);
59 return __shiftright128(lo, hi, (
unsigned char) dist);
65 umul128(
const uint64
a,
const uint64
b, uint64 *
const productHi)
76 const uint64 b00 = (uint64) aLo * bLo;
77 const uint64 b01 = (uint64) aLo * bHi;
78 const uint64 b10 = (uint64) aHi * bLo;
79 const uint64 b11 = (uint64) aHi * bHi;
84 const uint64 mid1 = b10 + b00Hi;
88 const uint64 mid2 = b01 + mid1Lo;
92 const uint64 pHi = b11 + mid1Hi + mid2Hi;
93 const uint64 pLo = ((uint64) mid2Lo << 32) + b00Lo;
104 #if !defined(RYU_32_BIT_PLATFORM)
106 return (hi << (64 - dist)) | (lo >> dist);
110 return (hi << (64 - dist)) | ((
uint32) (lo >> 32) >> (dist - 32));
116 #ifdef RYU_32_BIT_PLATFORM
120 umulh(
const uint64
a,
const uint64
b)
153 return umulh(
x, UINT64CONST(0xCCCCCCCCCCCCCCCD)) >> 2;
159 return umulh(
x, UINT64CONST(0xCCCCCCCCCCCCCCCD)) >> 3;
165 return umulh(
x >> 2, UINT64CONST(0x28F5C28F5C28F5C3)) >> 2;
171 return umulh(
x, UINT64CONST(0xABCC77118461CEFD)) >> 26;
197 return x / 100000000;
static uint64 div1e8(const uint64 x)
static uint64 div10(const uint64 x)
static uint64 umul128(const uint64 a, const uint64 b, uint64 *const productHi)
static uint64 div5(const uint64 x)
static uint64 shiftright128(const uint64 lo, const uint64 hi, const uint32 dist)
static uint64 div100(const uint64 x)
Assert(fmt[strlen(fmt) - 1] !='\n')