2 * Floating point arithmetic implementation
4 * The code in this source file is derived from release 2a of the SoftFloat
5 * IEC/IEEE Floating-point Arithmetic Package. Those parts of the code (and
6 * some later contributions) are provided under that license, as detailed below.
7 * It has subsequently been modified by contributors to the QEMU Project,
8 * so some portions are provided under:
9 * the SoftFloat-2a license
13 * Any future contributions to this file after December 1st 2014 will be
14 * taken to be licensed under the Softfloat-2a license unless specifically
15 * indicated otherwise.
18 static void partsN(add_normal)(FloatPartsN *a, FloatPartsN *b)
20 int exp_diff = a->exp - b->exp;
23 frac_shrjam(b, exp_diff);
24 } else if (exp_diff < 0) {
25 frac_shrjam(a, -exp_diff);
29 if (frac_add(a, a, b)) {
31 a->frac_hi |= DECOMPOSED_IMPLICIT_BIT;
36 static bool partsN(sub_normal)(FloatPartsN *a, FloatPartsN *b)
38 int exp_diff = a->exp - b->exp;
42 frac_shrjam(b, exp_diff);
44 } else if (exp_diff < 0) {
47 frac_shrjam(a, -exp_diff);
49 } else if (frac_sub(a, a, b)) {
50 /* Overflow means that A was less than B. */
55 shift = frac_normalize(a);
56 if (likely(shift < N)) {
60 a->cls = float_class_zero;