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

Go to the source code of this file.

Functions

float32_t f16_to_f32 (float16_t a)
 

Function Documentation

◆ f16_to_f32()

float32_t f16_to_f32 ( float16_t a)

Definition at line 44 of file f16_to_f32.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 uint_fast32_t uiZ;
53 struct exp8_sig16 normExpSig;
54 union ui32_f32 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 = packToF32UI( sign, 0xFF, 0 );
71 }
72 goto uiZ;
73 }
74 /*------------------------------------------------------------------------
75 *------------------------------------------------------------------------*/
76 if ( ! exp ) {
77 if ( ! frac ) {
78 uiZ = packToF32UI( sign, 0, 0 );
79 goto uiZ;
80 }
81 normExpSig = softfloat_normSubnormalF16Sig( frac );
82 exp = normExpSig.exp - 1;
83 frac = normExpSig.sig;
84 }
85 /*------------------------------------------------------------------------
86 *------------------------------------------------------------------------*/
87 uiZ = packToF32UI( sign, exp + 0x70, (uint_fast32_t) frac<<13 );
88 uiZ:
89 uZ.ui = uiZ;
90 return uZ.f;
91
92}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_f16UIToCommonNaN(uiA, zPtr)
Definition specialize.h:96
#define softfloat_commonNaNToF32UI(aPtr)
Definition specialize.h:137
#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)
#define packToF32UI(sign, exp, sig)
Definition internals.h:107
uint16_t uint_fast16_t
Definition stdint.h:155
int8_t int_fast8_t
Definition stdint.h:150
uint32_t uint_fast32_t
Definition stdint.h:156
float32_t f
Definition internals.h:46
Here is the call graph for this function: