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

Go to the source code of this file.

Functions

uint_fast64_t extF80M_to_ui64_r_minMag (const extFloat80_t *aPtr, bool exact)
 

Function Documentation

◆ extF80M_to_ui64_r_minMag()

uint_fast64_t extF80M_to_ui64_r_minMag ( const extFloat80_t * aPtr,
bool exact )

Definition at line 55 of file extF80M_to_ui64_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 z;
64
65 /*------------------------------------------------------------------------
66 *------------------------------------------------------------------------*/
67 aSPtr = (const struct extFloat80M *) aPtr;
68 uiA64 = aSPtr->signExp;
69 exp = expExtF80UI64( uiA64 );
70 sig = aSPtr->signif;
71 /*------------------------------------------------------------------------
72 *------------------------------------------------------------------------*/
73 if ( ! sig && (exp != 0x7FFF) ) return 0;
74 shiftDist = 0x403E - exp;
75 if ( 64 <= shiftDist ) {
77 return 0;
78 }
79 /*------------------------------------------------------------------------
80 *------------------------------------------------------------------------*/
81 sign = signExtF80UI64( uiA64 );
82 if ( shiftDist < 0 ) {
83 if ( sign || (shiftDist <= -63) ) goto invalid;
84 shiftDist = -shiftDist;
85 z = sig<<shiftDist;
86 if ( z>>shiftDist != sig ) goto invalid;
87 } else {
88 z = sig;
89 if ( shiftDist ) z >>= shiftDist;
90 if ( sign && z ) goto invalid;
91 if ( exact && shiftDist && (z<<shiftDist != sig) ) {
93 }
94 }
95 return z;
96 /*------------------------------------------------------------------------
97 *------------------------------------------------------------------------*/
98 invalid:
100 return
101 (exp == 0x7FFF) && (sig & UINT64_C( 0x7FFFFFFFFFFFFFFF ))
104
105}
void softfloat_raiseFlags(uint_fast8_t flags)
#define ui64_fromPosOverflow
Definition specialize.h:65
#define ui64_fromNegOverflow
Definition specialize.h:66
#define ui64_fromNaN
Definition specialize.h:67
#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
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: