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

Go to the source code of this file.

Functions

uint_fast32_t extF80M_to_ui32 (const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact)
 

Function Documentation

◆ extF80M_to_ui32()

uint_fast32_t extF80M_to_ui32 ( const extFloat80_t * aPtr,
uint_fast8_t roundingMode,
bool exact )

Definition at line 58 of file extF80M_to_ui32.c.

60{
61 const struct extFloat80M *aSPtr;
62 uint_fast16_t uiA64;
63 bool sign;
64 int32_t exp;
65 uint64_t sig;
66 int32_t shiftDist;
67
68 /*------------------------------------------------------------------------
69 *------------------------------------------------------------------------*/
70 aSPtr = (const struct extFloat80M *) aPtr;
71 uiA64 = aSPtr->signExp;
72 sign = signExtF80UI64( uiA64 );
73 exp = expExtF80UI64( uiA64 );
74 sig = aSPtr->signif;
75 /*------------------------------------------------------------------------
76 *------------------------------------------------------------------------*/
77 shiftDist = 0x4032 - exp;
78 if ( shiftDist <= 0 ) {
79 if ( sig>>32 ) goto invalid;
80 if ( -32 < shiftDist ) {
81 sig <<= -shiftDist;
82 } else {
83 if ( (uint32_t) sig ) goto invalid;
84 }
85 } else {
86 sig = softfloat_shiftRightJam64( sig, shiftDist );
87 }
88 return softfloat_roundToUI32( sign, sig, roundingMode, exact );
89 /*------------------------------------------------------------------------
90 *------------------------------------------------------------------------*/
91 invalid:
93 return
94 (exp == 0x7FFF) && (sig & UINT64_C( 0x7FFFFFFFFFFFFFFF ))
97
98}
void softfloat_raiseFlags(uint_fast8_t flags)
#define ui32_fromNegOverflow
Definition specialize.h:55
#define ui32_fromPosOverflow
Definition specialize.h:54
#define ui32_fromNaN
Definition specialize.h:56
#define expExtF80UI64(a64)
Definition internals.h:147
#define signExtF80UI64(a64)
Definition internals.h:146
uint_fast32_t softfloat_roundToUI32(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
unsigned int uint32_t
Definition stdint.h:126
uint16_t uint_fast16_t
Definition stdint.h:155
#define UINT64_C(val)
Definition stdint.h:284
signed int int32_t
Definition stdint.h:123
unsigned __int64 uint64_t
Definition stdint.h:136
uint64_t signif
uint16_t signExp
Here is the call graph for this function: