45{
53 bool signZ;
59
60
61
66
67
68 expDiff = expA - expB;
69 if ( ! expDiff ) {
70
71
72 if ( expA == 0x1F ) {
73 if ( sigA | sigB ) goto propagateNaN;
76 goto uiZ;
77 }
78 sigDiff = sigA - sigB;
79 if ( ! sigDiff ) {
80 uiZ =
83 goto uiZ;
84 }
85 if ( expA ) --expA;
87 if ( sigDiff < 0 ) {
88 signZ = ! signZ;
89 sigDiff = -sigDiff;
90 }
92 expZ = expA - shiftDist;
93 if ( expZ < 0 ) {
94 shiftDist = expA;
95 expZ = 0;
96 }
97 sigZ = sigDiff<<shiftDist;
99 } else {
100
101
103 if ( expDiff < 0 ) {
104
105
106 signZ = ! signZ;
107 if ( expB == 0x1F ) {
108 if ( sigB ) goto propagateNaN;
110 goto uiZ;
111 }
112 if ( expDiff <= -13 ) {
114 if ( expA | sigA ) goto subEpsilon;
115 goto uiZ;
116 }
117 expZ = expA + 19;
118 sigX = sigB | 0x0400;
119 sigY = sigA + (expA ? 0x0400 : sigA);
120 expDiff = -expDiff;
121 } else {
122
123
124 uiZ = uiA;
125 if ( expA == 0x1F ) {
126 if ( sigA ) goto propagateNaN;
127 goto uiZ;
128 }
129 if ( 13 <= expDiff ) {
130 if ( expB | sigB ) goto subEpsilon;
131 goto uiZ;
132 }
133 expZ = expB + 19;
134 sigX = sigA | 0x0400;
135 sigY = sigB + (expB ? 0x0400 : sigB);
136 }
139 sig32Z <<= shiftDist;
140 expZ -= shiftDist;
141 sigZ = sig32Z>>16;
142 if ( sig32Z & 0xFFFF ) {
143 sigZ |= 1;
144 } else {
145 if ( ! (sigZ & 0xF) && ((unsigned int) expZ < 0x1E) ) {
146 sigZ >>= 4;
148 }
149 }
151 }
152
153
154 propagateNaN:
156 goto uiZ;
157
158
159 subEpsilon:
162 if (
164 || (roundingMode
167 ) {
168 --uiZ;
169 }
170#ifdef SOFTFLOAT_ROUND_ODD
172 uiZ = (uiZ - 1) | 1;
173 }
174#endif
175 }
177 goto uiZ;
178
179
182 uiZ:
183 uZ.ui = uiZ;
184 return uZ.f;
185
186}
void pack(instruction_stream *stream, uint32_t field)
uint_fast16_t softfloat_propagateNaNF16UI(uint_fast16_t uiA, uint_fast16_t uiB)
void softfloat_raiseFlags(uint_fast8_t flags)
float16_t softfloat_roundPackToF16(bool, int_fast16_t, uint_fast16_t)
#define packToF16UI(sign, exp, sig)
THREAD_LOCAL uint_fast8_t softfloat_roundingMode
THREAD_LOCAL uint_fast8_t softfloat_exceptionFlags
@ softfloat_round_near_even
#define softfloat_countLeadingZeros16
#define softfloat_countLeadingZeros32