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

Go to the source code of this file.

Functions

void f64_to_f128M (float64_t a, float128_t *zPtr)
 

Function Documentation

◆ f64_to_f128M()

void f64_to_f128M ( float64_t a,
float128_t * zPtr )

Definition at line 55 of file f64_to_f128M.c.

56{
57 uint32_t *zWPtr;
58 union ui64_f64 uA;
59 uint64_t uiA;
60 bool sign;
61 int_fast16_t exp;
62 uint64_t frac;
63 struct commonNaN commonNaN;
64 uint32_t uiZ96;
65 struct exp16_sig64 normExpSig;
66
67 /*------------------------------------------------------------------------
68 *------------------------------------------------------------------------*/
69 zWPtr = (uint32_t *) zPtr;
70 /*------------------------------------------------------------------------
71 *------------------------------------------------------------------------*/
72 uA.f = a;
73 uiA = uA.ui;
74 sign = signF64UI( uiA );
75 exp = expF64UI( uiA );
76 frac = fracF64UI( uiA );
77 /*------------------------------------------------------------------------
78 *------------------------------------------------------------------------*/
79 zWPtr[indexWord( 4, 0 )] = 0;
80 if ( exp == 0x7FF ) {
81 if ( frac ) {
84 return;
85 }
86 uiZ96 = packToF128UI96( sign, 0x7FFF, 0 );
87 goto uiZ;
88 }
89 /*------------------------------------------------------------------------
90 *------------------------------------------------------------------------*/
91 if ( ! exp ) {
92 if ( ! frac ) {
93 uiZ96 = packToF128UI96( sign, 0, 0 );
94 goto uiZ;
95 }
96 normExpSig = softfloat_normSubnormalF64Sig( frac );
97 exp = normExpSig.exp - 1;
98 frac = normExpSig.sig;
99 }
100 /*------------------------------------------------------------------------
101 *------------------------------------------------------------------------*/
102 zWPtr[indexWord( 4, 1 )] = (uint32_t) frac<<28;
103 frac >>= 4;
104 zWPtr[indexWordHi( 4 )] = packToF128UI96( sign, exp + 0x3C00, frac>>32 );
105 zWPtr[indexWord( 4, 2 )] = frac;
106 return;
107 /*------------------------------------------------------------------------
108 *------------------------------------------------------------------------*/
109 uiZ:
110 zWPtr[indexWord( 4, 3 )] = uiZ96;
111 zWPtr[indexWord( 4, 2 )] = 0;
112 zWPtr[indexWord( 4, 1 )] = 0;
113
114}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_commonNaNToF128M
#define softfloat_f64UIToCommonNaN(uiA, zPtr)
Definition specialize.h:166
#define packToF128UI96(sign, exp, sig96)
Definition internals.h:250
struct exp16_sig64 softfloat_normSubnormalF64Sig(uint_fast64_t)
#define signF64UI(a)
Definition internals.h:125
#define expF64UI(a)
Definition internals.h:126
#define fracF64UI(a)
Definition internals.h:127
#define indexWord(total, n)
#define indexWordHi(total)
unsigned int uint32_t
Definition stdint.h:126
int16_t int_fast16_t
Definition stdint.h:151
unsigned __int64 uint64_t
Definition stdint.h:136
int_fast16_t exp
Definition internals.h:132
Here is the call graph for this function:
Here is the caller graph for this function: