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

Go to the source code of this file.

Functions

float128_t f16_to_f128 (float16_t a)
 

Function Documentation

◆ f16_to_f128()

float128_t f16_to_f128 ( float16_t a)

Definition at line 44 of file f16_to_f128.c.

45{
46 union ui16_f16 uA;
47 uint_fast16_t uiA;
48 bool sign;
49 int_fast8_t exp;
50 uint_fast16_t frac;
51 struct commonNaN commonNaN;
52 struct uint128 uiZ;
53 struct exp8_sig16 normExpSig;
54 union ui128_f128 uZ;
55
56 /*------------------------------------------------------------------------
57 *------------------------------------------------------------------------*/
58 uA.f = a;
59 uiA = uA.ui;
60 sign = signF16UI( uiA );
61 exp = expF16UI( uiA );
62 frac = fracF16UI( uiA );
63 /*------------------------------------------------------------------------
64 *------------------------------------------------------------------------*/
65 if ( exp == 0x1F ) {
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_normSubnormalF16Sig( frac );
84 exp = normExpSig.exp - 1;
85 frac = normExpSig.sig;
86 }
87 /*------------------------------------------------------------------------
88 *------------------------------------------------------------------------*/
89 uiZ.v64 = packToF128UI64( sign, exp + 0x3FF0, (uint_fast64_t) frac<<38 );
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_f16UIToCommonNaN(uiA, zPtr)
Definition specialize.h:96
#define expF16UI(a)
Definition internals.h:84
#define signF16UI(a)
Definition internals.h:83
#define fracF16UI(a)
Definition internals.h:85
struct exp8_sig16 softfloat_normSubnormalF16Sig(uint_fast16_t)
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
Here is the call graph for this function: