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

Go to the source code of this file.

Functions

int_fast64_t f128M_to_i64 (const float128_t *aPtr, uint_fast8_t roundingMode, bool exact)
 

Function Documentation

◆ f128M_to_i64()

int_fast64_t f128M_to_i64 ( const float128_t * aPtr,
uint_fast8_t roundingMode,
bool exact )

Definition at line 57 of file f128M_to_i64.c.

58{
59 const uint32_t *aWPtr;
60 uint32_t uiA96;
61 bool sign;
62 int32_t exp;
63 uint32_t sig96;
64 int32_t shiftDist;
65 uint32_t sig[4];
66
67 /*------------------------------------------------------------------------
68 *------------------------------------------------------------------------*/
69 aWPtr = (const uint32_t *) aPtr;
70 uiA96 = aWPtr[indexWordHi( 4 )];
71 sign = signF128UI96( uiA96 );
72 exp = expF128UI96( uiA96 );
73 sig96 = fracF128UI96( uiA96 );
74 /*------------------------------------------------------------------------
75 *------------------------------------------------------------------------*/
76 shiftDist = 0x404F - exp;
77 if ( shiftDist < 17 ) {
79 return
80 (exp == 0x7FFF)
81 && (sig96
82 || (aWPtr[indexWord( 4, 2 )] | aWPtr[indexWord( 4, 1 )]
83 | aWPtr[indexWord( 4, 0 )]))
86 }
87 /*------------------------------------------------------------------------
88 *------------------------------------------------------------------------*/
89 if ( exp ) sig96 |= 0x00010000;
90 sig[indexWord( 4, 3 )] = sig96;
91 sig[indexWord( 4, 2 )] = aWPtr[indexWord( 4, 2 )];
92 sig[indexWord( 4, 1 )] = aWPtr[indexWord( 4, 1 )];
93 sig[indexWord( 4, 0 )] = aWPtr[indexWord( 4, 0 )];
94 softfloat_shiftRightJam128M( sig, shiftDist, sig );
95 return
97 sign, sig + indexMultiwordLo( 4, 3 ), roundingMode, exact );
98
99}
void softfloat_raiseFlags(uint_fast8_t flags)
#define i64_fromNaN
Definition specialize.h:70
#define i64_fromNegOverflow
Definition specialize.h:69
#define i64_fromPosOverflow
Definition specialize.h:68
#define fracF128UI96(a96)
Definition internals.h:249
int_fast64_t softfloat_roundMToI64(bool, uint32_t *, uint_fast8_t, bool)
#define signF128UI96(a96)
Definition internals.h:247
#define expF128UI96(a96)
Definition internals.h:248
#define indexMultiwordLo(total, n)
#define indexWord(total, n)
#define indexWordHi(total)
#define softfloat_shiftRightJam128M(aPtr, dist, zPtr)
Definition primitives.h:881
@ softfloat_flag_invalid
Definition softfloat.h:89
unsigned int uint32_t
Definition stdint.h:126
signed int int32_t
Definition stdint.h:123
Here is the call graph for this function: