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

Go to the source code of this file.

Functions

float128_t f32_to_f128 (float32_t a)
 

Function Documentation

◆ f32_to_f128()

float128_t f32_to_f128 ( float32_t a)

Definition at line 44 of file f32_to_f128.c.

45{
46 union ui32_f32 uA;
47 uint_fast32_t uiA;
48 bool sign;
49 int_fast16_t exp;
50 uint_fast32_t frac;
51 struct commonNaN commonNaN;
52 struct uint128 uiZ;
53 struct exp16_sig32 normExpSig;
54 union ui128_f128 uZ;
55
56 /*------------------------------------------------------------------------
57 *------------------------------------------------------------------------*/
58 uA.f = a;
59 uiA = uA.ui;
60 sign = signF32UI( uiA );
61 exp = expF32UI( uiA );
62 frac = fracF32UI( uiA );
63 /*------------------------------------------------------------------------
64 *------------------------------------------------------------------------*/
65 if ( exp == 0xFF ) {
66 if ( frac ) {
69 } else {
70 uiZ.v64 = packToF128UI64( sign, 0x7FFF, 0 );
71 uiZ.v0 = 0;
72 }
73 goto uiZ;
74 }
75 /*------------------------------------------------------------------------
76 *------------------------------------------------------------------------*/
77 if ( ! exp ) {
78 if ( ! frac ) {
79 uiZ.v64 = packToF128UI64( sign, 0, 0 );
80 uiZ.v0 = 0;
81 goto uiZ;
82 }
83 normExpSig = softfloat_normSubnormalF32Sig( frac );
84 exp = normExpSig.exp - 1;
85 frac = normExpSig.sig;
86 }
87 /*------------------------------------------------------------------------
88 *------------------------------------------------------------------------*/
89 uiZ.v64 = packToF128UI64( sign, exp + 0x3F80, (uint_fast64_t) frac<<25 );
90 uiZ.v0 = 0;
91 uiZ:
92 uZ.ui = uiZ;
93 return uZ.f;
94
95}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_commonNaNToF128UI
#define softfloat_f32UIToCommonNaN(uiA, zPtr)
Definition specialize.h:131
#define expF32UI(a)
Definition internals.h:105
struct exp16_sig32 softfloat_normSubnormalF32Sig(uint_fast32_t)
#define fracF32UI(a)
Definition internals.h:106
#define signF32UI(a)
Definition internals.h:104
uint64_t uint_fast64_t
Definition stdint.h:157
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: