Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
f128_to_extF80.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 f128_to_extF80.c:

Go to the source code of this file.

Functions

extFloat80_t f128_to_extF80 (float128_t a)
 

Function Documentation

◆ f128_to_extF80()

extFloat80_t f128_to_extF80 ( float128_t a)

Definition at line 44 of file f128_to_extF80.c.

45{
46 union ui128_f128 uA;
47 uint_fast64_t uiA64, uiA0;
48 bool sign;
49 int_fast32_t exp;
50 uint_fast64_t frac64, frac0;
51 struct commonNaN commonNaN;
52 struct uint128 uiZ;
53 uint_fast16_t uiZ64;
54 uint_fast64_t uiZ0;
55 struct exp32_sig128 normExpSig;
56 struct uint128 sig128;
57 union { struct extFloat80M s; extFloat80_t f; } uZ;
58
59 /*------------------------------------------------------------------------
60 *------------------------------------------------------------------------*/
61 uA.f = a;
62 uiA64 = uA.ui.v64;
63 uiA0 = uA.ui.v0;
64 sign = signF128UI64( uiA64 );
65 exp = expF128UI64( uiA64 );
66 frac64 = fracF128UI64( uiA64 );
67 frac0 = uiA0;
68 /*------------------------------------------------------------------------
69 *------------------------------------------------------------------------*/
70 if ( exp == 0x7FFF ) {
71 if ( frac64 | frac0 ) {
74 uiZ64 = uiZ.v64;
75 uiZ0 = uiZ.v0;
76 } else {
77 uiZ64 = packToExtF80UI64( sign, 0x7FFF );
78 uiZ0 = UINT64_C( 0x8000000000000000 );
79 }
80 goto uiZ;
81 }
82 /*------------------------------------------------------------------------
83 *------------------------------------------------------------------------*/
84 if ( ! exp ) {
85 if ( ! (frac64 | frac0) ) {
86 uiZ64 = packToExtF80UI64( sign, 0 );
87 uiZ0 = 0;
88 goto uiZ;
89 }
90 normExpSig = softfloat_normSubnormalF128Sig( frac64, frac0 );
91 exp = normExpSig.exp;
92 frac64 = normExpSig.sig.v64;
93 frac0 = normExpSig.sig.v0;
94 }
95 /*------------------------------------------------------------------------
96 *------------------------------------------------------------------------*/
97 sig128 =
99 frac64 | UINT64_C( 0x0001000000000000 ), frac0, 15 );
100 return softfloat_roundPackToExtF80( sign, exp, sig128.v64, sig128.v0, 80 );
101 /*------------------------------------------------------------------------
102 *------------------------------------------------------------------------*/
103 uiZ:
104 uZ.s.signExp = uiZ64;
105 uZ.s.signif = uiZ0;
106 return uZ.f;
107
108}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
void softfloat_f128UIToCommonNaN(uint_fast64_t uiA64, uint_fast64_t uiA0, struct commonNaN *zPtr)
#define softfloat_commonNaNToExtF80UI
#define packToExtF80UI64(sign, exp)
Definition internals.h:148
struct exp32_sig128 softfloat_normSubnormalF128Sig(uint_fast64_t sig64, uint_fast64_t sig0)
extFloat80_t softfloat_roundPackToExtF80(bool sign, int_fast32_t exp, uint_fast64_t sig, uint_fast64_t sigExtra, uint_fast8_t roundingPrecision)
struct uint128 softfloat_shortShiftLeft128(uint64_t a64, uint64_t a0, uint_fast8_t dist)
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
#define UINT64_C(val)
Definition stdint.h:284
int32_t int_fast32_t
Definition stdint.h:152
char * s
Here is the call graph for this function: