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

Go to the source code of this file.

Functions

void f16_to_f128M (float16_t a, float128_t *zPtr)
 

Function Documentation

◆ f16_to_f128M()

void f16_to_f128M ( float16_t a,
float128_t * zPtr )

Definition at line 55 of file f16_to_f128M.c.

56{
57 uint32_t *zWPtr;
58 union ui16_f16 uA;
59 uint16_t uiA;
60 bool sign;
61 int_fast8_t exp;
62 uint16_t frac;
63 struct commonNaN commonNaN;
64 uint32_t uiZ96;
65 struct exp8_sig16 normExpSig;
66
67 /*------------------------------------------------------------------------
68 *------------------------------------------------------------------------*/
69 zWPtr = (uint32_t *) zPtr;
70 /*------------------------------------------------------------------------
71 *------------------------------------------------------------------------*/
72 uA.f = a;
73 uiA = uA.ui;
74 sign = signF16UI( uiA );
75 exp = expF16UI( uiA );
76 frac = fracF16UI( uiA );
77 /*------------------------------------------------------------------------
78 *------------------------------------------------------------------------*/
79 if ( exp == 0x1F ) {
80 if ( frac ) {
83 return;
84 }
85 uiZ96 = packToF128UI96( sign, 0x7FFF, 0 );
86 goto uiZ;
87 }
88 /*------------------------------------------------------------------------
89 *------------------------------------------------------------------------*/
90 if ( ! exp ) {
91 if ( ! frac ) {
92 uiZ96 = packToF128UI96( sign, 0, 0 );
93 goto uiZ;
94 }
95 normExpSig = softfloat_normSubnormalF16Sig( frac );
96 exp = normExpSig.exp - 1;
97 frac = normExpSig.sig;
98 }
99 /*------------------------------------------------------------------------
100 *------------------------------------------------------------------------*/
101 uiZ96 = packToF128UI96( sign, exp + 0x3FF0, (uint32_t) frac<<6 );
102 uiZ:
103 zWPtr[indexWord( 4, 3 )] = uiZ96;
104 zWPtr[indexWord( 4, 2 )] = 0;
105 zWPtr[indexWord( 4, 1 )] = 0;
106 zWPtr[indexWord( 4, 0 )] = 0;
107
108}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_commonNaNToF128M
#define softfloat_f16UIToCommonNaN(uiA, zPtr)
Definition specialize.h:96
#define expF16UI(a)
Definition internals.h:84
#define packToF128UI96(sign, exp, sig96)
Definition internals.h:250
#define signF16UI(a)
Definition internals.h:83
#define fracF16UI(a)
Definition internals.h:85
struct exp8_sig16 softfloat_normSubnormalF16Sig(uint_fast16_t)
#define indexWord(total, n)
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
int8_t int_fast8_t
Definition stdint.h:150
int_fast8_t exp
Definition internals.h:90
Here is the call graph for this function: