45{
46 union ui128_f128 uA;
48 bool signA;
50 struct uint128 sigA;
51 union ui128_f128 uB;
53 bool signB;
55 struct uint128 sigB;
56 bool signZ;
58 struct exp32_sig128 normExpSig;
62 struct uint128 sigZ;
63 struct uint128_extra sig128Extra;
64 struct uint128 uiZ;
65 union ui128_f128 uZ;
66
67
68
70 uiA64 = uA.ui.v64;
71 uiA0 = uA.ui.v0;
72 signA = signF128UI64( uiA64 );
73 expA = expF128UI64( uiA64 );
74 sigA.v64 = fracF128UI64( uiA64 );
75 sigA.v0 = uiA0;
76 uB.f = b;
77 uiB64 = uB.ui.v64;
78 uiB0 = uB.ui.v0;
79 signB = signF128UI64( uiB64 );
80 expB = expF128UI64( uiB64 );
81 sigB.v64 = fracF128UI64( uiB64 );
82 sigB.v0 = uiB0;
83 signZ = signA ^ signB;
84
85
86 if ( expA == 0x7FFF ) {
87 if (
88 (sigA.v64 | sigA.v0) || ((expB == 0x7FFF) && (sigB.v64 | sigB.v0))
89 ) {
90 goto propagateNaN;
91 }
92 magBits = expB | sigB.v64 | sigB.v0;
93 goto infArg;
94 }
95 if ( expB == 0x7FFF ) {
96 if ( sigB.v64 | sigB.v0 ) goto propagateNaN;
97 magBits = expA | sigA.v64 | sigA.v0;
98 goto infArg;
99 }
100
101
102 if ( ! expA ) {
103 if ( ! (sigA.v64 | sigA.v0) ) goto zero;
105 expA = normExpSig.exp;
106 sigA = normExpSig.sig;
107 }
108 if ( ! expB ) {
109 if ( ! (sigB.v64 | sigB.v0) ) goto zero;
111 expB = normExpSig.exp;
112 sigB = normExpSig.sig;
113 }
114
115
116 expZ = expA + expB - 0x4000;
117 sigA.v64 |=
UINT64_C( 0x0001000000000000 );
121 sigZ =
124 sigA.v64, sigA.v0
125 );
126 if (
UINT64_C( 0x0002000000000000 ) <= sigZ.v64 ) {
127 ++expZ;
128 sig128Extra =
130 sigZ.v64, sigZ.v0, sigZExtra, 1 );
131 sigZ = sig128Extra.v;
132 sigZExtra = sig128Extra.extra;
133 }
134 return
136
137
138 propagateNaN:
140 goto uiZ;
141
142
143 infArg:
144 if ( ! magBits ) {
148 goto uiZ;
149 }
150 uiZ.v64 = packToF128UI64( signZ, 0x7FFF, 0 );
151 goto uiZ0;
152
153
154 zero:
155 uiZ.v64 = packToF128UI64( signZ, 0, 0 );
156 uiZ0:
157 uiZ.v0 = 0;
158 uiZ:
159 uZ.ui = uiZ;
160 return uZ.f;
161
162}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
struct uint128 softfloat_propagateNaNF128UI(uint_fast64_t uiA64, uint_fast64_t uiA0, uint_fast64_t uiB64, uint_fast64_t uiB0)
void softfloat_raiseFlags(uint_fast8_t flags)
#define defaultNaNF128UI64
#define defaultNaNF128UI0
#define indexWord(total, n)
struct uint128 softfloat_add128(uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0)
#define softfloat_mul128To256M
struct exp32_sig128 softfloat_normSubnormalF128Sig(uint_fast64_t sig64, uint_fast64_t sig0)
float128_t softfloat_roundPackToF128(bool sign, int_fast32_t exp, uint_fast64_t sig64, uint_fast64_t sig0, uint_fast64_t sigExtra)
struct uint128 softfloat_shortShiftLeft128(uint64_t a64, uint64_t a0, uint_fast8_t dist)
unsigned __int64 uint64_t