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

Go to the source code of this file.

Functions

uint_fast32_t extF80M_to_ui32_r_minMag (const extFloat80_t *aPtr, bool exact)
 

Function Documentation

◆ extF80M_to_ui32_r_minMag()

uint_fast32_t extF80M_to_ui32_r_minMag ( const extFloat80_t * aPtr,
bool exact )

Definition at line 55 of file extF80M_to_ui32_r_minMag.c.

56{
57 const struct extFloat80M *aSPtr;
58 uint_fast16_t uiA64;
59 int32_t exp;
60 uint64_t sig;
61 int32_t shiftDist;
62 bool sign;
63 uint64_t shiftedSig;
64 uint32_t z;
65
66 /*------------------------------------------------------------------------
67 *------------------------------------------------------------------------*/
68 aSPtr = (const struct extFloat80M *) aPtr;
69 uiA64 = aSPtr->signExp;
70 exp = expExtF80UI64( uiA64 );
71 sig = aSPtr->signif;
72 /*------------------------------------------------------------------------
73 *------------------------------------------------------------------------*/
74 if ( ! sig && (exp != 0x7FFF) ) return 0;
75 shiftDist = 0x403E - exp;
76 if ( 64 <= shiftDist ) {
78 return 0;
79 }
80 /*------------------------------------------------------------------------
81 *------------------------------------------------------------------------*/
82 sign = signExtF80UI64( uiA64 );
83 if ( shiftDist < 0 ) {
84 if ( sign || sig>>32 || (shiftDist <= -31) ) goto invalid;
85 shiftedSig = (uint64_t) (uint32_t) sig<<-shiftDist;
86 if ( shiftedSig>>32 ) goto invalid;
87 z = shiftedSig;
88 } else {
89 shiftedSig = sig;
90 if ( shiftDist ) shiftedSig >>= shiftDist;
91 if ( shiftedSig>>32 ) goto invalid;
92 z = shiftedSig;
93 if ( sign && z ) goto invalid;
94 if ( exact && shiftDist && ((uint64_t) z<<shiftDist != sig) ) {
96 }
97 }
98 return z;
99 /*------------------------------------------------------------------------
100 *------------------------------------------------------------------------*/
101 invalid:
103 return
104 (exp == 0x7FFF) && (sig & UINT64_C( 0x7FFFFFFFFFFFFFFF ))
107
108}
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
@ softfloat_flag_invalid
Definition softfloat.h:89
@ softfloat_flag_inexact
Definition softfloat.h:85
THREAD_LOCAL uint_fast8_t softfloat_exceptionFlags
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: