Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
s_addMagsF32.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
Include dependency graph for s_addMagsF32.c:

Go to the source code of this file.

Functions

float32_t softfloat_addMagsF32 (uint_fast32_t uiA, uint_fast32_t uiB)
 

Function Documentation

◆ softfloat_addMagsF32()

float32_t softfloat_addMagsF32 ( uint_fast32_t uiA,
uint_fast32_t uiB )

Definition at line 43 of file s_addMagsF32.c.

44{
45 int_fast16_t expA;
46 uint_fast32_t sigA;
47 int_fast16_t expB;
48 uint_fast32_t sigB;
49 int_fast16_t expDiff;
50 uint_fast32_t uiZ;
51 bool signZ;
52 int_fast16_t expZ;
53 uint_fast32_t sigZ;
54 union ui32_f32 uZ;
55
56 /*------------------------------------------------------------------------
57 *------------------------------------------------------------------------*/
58 expA = expF32UI( uiA );
59 sigA = fracF32UI( uiA );
60 expB = expF32UI( uiB );
61 sigB = fracF32UI( uiB );
62 /*------------------------------------------------------------------------
63 *------------------------------------------------------------------------*/
64 expDiff = expA - expB;
65 if ( ! expDiff ) {
66 /*--------------------------------------------------------------------
67 *--------------------------------------------------------------------*/
68 if ( ! expA ) {
69 uiZ = uiA + sigB;
70 goto uiZ;
71 }
72 if ( expA == 0xFF ) {
73 if ( sigA | sigB ) goto propagateNaN;
74 uiZ = uiA;
75 goto uiZ;
76 }
77 signZ = signF32UI( uiA );
78 expZ = expA;
79 sigZ = 0x01000000 + sigA + sigB;
80 if ( ! (sigZ & 1) && (expZ < 0xFE) ) {
81 uiZ = packToF32UI( signZ, expZ, sigZ>>1 );
82 goto uiZ;
83 }
84 sigZ <<= 6;
85 } else {
86 /*--------------------------------------------------------------------
87 *--------------------------------------------------------------------*/
88 signZ = signF32UI( uiA );
89 sigA <<= 6;
90 sigB <<= 6;
91 if ( expDiff < 0 ) {
92 if ( expB == 0xFF ) {
93 if ( sigB ) goto propagateNaN;
94 uiZ = packToF32UI( signZ, 0xFF, 0 );
95 goto uiZ;
96 }
97 expZ = expB;
98 sigA += expA ? 0x20000000 : sigA;
99 sigA = softfloat_shiftRightJam32( sigA, -expDiff );
100 } else {
101 if ( expA == 0xFF ) {
102 if ( sigA ) goto propagateNaN;
103 uiZ = uiA;
104 goto uiZ;
105 }
106 expZ = expA;
107 sigB += expB ? 0x20000000 : sigB;
108 sigB = softfloat_shiftRightJam32( sigB, expDiff );
109 }
110 sigZ = 0x20000000 + sigA + sigB;
111 if ( sigZ < 0x40000000 ) {
112 --expZ;
113 sigZ <<= 1;
114 }
115 }
116 return softfloat_roundPackToF32( signZ, expZ, sigZ );
117 /*------------------------------------------------------------------------
118 *------------------------------------------------------------------------*/
119 propagateNaN:
120 uiZ = softfloat_propagateNaNF32UI( uiA, uiB );
121 uiZ:
122 uZ.ui = uiZ;
123 return uZ.f;
124
125}
uint_fast32_t softfloat_propagateNaNF32UI(uint_fast32_t uiA, uint_fast32_t uiB)
#define expF32UI(a)
Definition internals.h:105
float32_t softfloat_roundPackToF32(bool, int_fast16_t, uint_fast32_t)
#define fracF32UI(a)
Definition internals.h:106
#define signF32UI(a)
Definition internals.h:104
#define packToF32UI(sign, exp, sig)
Definition internals.h:107
uint32_t softfloat_shiftRightJam32(uint32_t a, uint_fast16_t dist)
uint32_t uint_fast32_t
Definition stdint.h:156
int16_t int_fast16_t
Definition stdint.h:151
Here is the call graph for this function:
Here is the caller graph for this function: