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

Go to the source code of this file.

Functions

int_fast32_t extF80_to_i32 (extFloat80_t a, uint_fast8_t roundingMode, bool exact)
 

Function Documentation

◆ extF80_to_i32()

int_fast32_t extF80_to_i32 ( extFloat80_t a,
uint_fast8_t roundingMode,
bool exact )

Definition at line 45 of file extF80_to_i32.c.

46{
47 union { struct extFloat80M s; extFloat80_t f; } uA;
48 uint_fast16_t uiA64;
49 bool sign;
50 int_fast32_t exp;
51 uint_fast64_t sig;
52 int_fast32_t shiftDist;
53
54 /*------------------------------------------------------------------------
55 *------------------------------------------------------------------------*/
56 uA.f = a;
57 uiA64 = uA.s.signExp;
58 sign = signExtF80UI64( uiA64 );
59 exp = expExtF80UI64( uiA64 );
60 sig = uA.s.signif;
61 /*------------------------------------------------------------------------
62 *------------------------------------------------------------------------*/
63#if (i32_fromNaN != i32_fromPosOverflow) || (i32_fromNaN != i32_fromNegOverflow)
64 if ( (exp == 0x7FFF) && (sig & UINT64_C( 0x7FFFFFFFFFFFFFFF )) ) {
65#if (i32_fromNaN == i32_fromPosOverflow)
66 sign = 0;
67#elif (i32_fromNaN == i32_fromNegOverflow)
68 sign = 1;
69#else
71 return i32_fromNaN;
72#endif
73 }
74#endif
75 /*------------------------------------------------------------------------
76 *------------------------------------------------------------------------*/
77 shiftDist = 0x4032 - exp;
78 if ( shiftDist <= 0 ) shiftDist = 1;
79 sig = softfloat_shiftRightJam64( sig, shiftDist );
80 return softfloat_roundToI32( sign, sig, roundingMode, exact );
81
82}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
void softfloat_raiseFlags(uint_fast8_t flags)
#define i32_fromNaN
Definition specialize.h:59
#define expExtF80UI64(a64)
Definition internals.h:147
#define signExtF80UI64(a64)
Definition internals.h:146
int_fast32_t softfloat_roundToI32(bool, uint_fast64_t, uint_fast8_t, bool)
uint64_t softfloat_shiftRightJam64(uint64_t a, uint_fast32_t dist)
@ softfloat_flag_invalid
Definition softfloat.h:89
uint16_t uint_fast16_t
Definition stdint.h:155
uint64_t uint_fast64_t
Definition stdint.h:157
#define UINT64_C(val)
Definition stdint.h:284
int32_t int_fast32_t
Definition stdint.h:152
char * s
Here is the call graph for this function: