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

Go to the source code of this file.

Functions

int_fast64_t f64_to_i64_r_minMag (float64_t a, bool exact)
 

Function Documentation

◆ f64_to_i64_r_minMag()

int_fast64_t f64_to_i64_r_minMag ( float64_t a,
bool exact )

Definition at line 44 of file f64_to_i64_r_minMag.c.

45{
46 union ui64_f64 uA;
47 uint_fast64_t uiA;
48 bool sign;
49 int_fast16_t exp;
50 uint_fast64_t sig;
51 int_fast16_t shiftDist;
52 int_fast64_t absZ;
53
54 /*------------------------------------------------------------------------
55 *------------------------------------------------------------------------*/
56 uA.f = a;
57 uiA = uA.ui;
58 sign = signF64UI( uiA );
59 exp = expF64UI( uiA );
60 sig = fracF64UI( uiA );
61 /*------------------------------------------------------------------------
62 *------------------------------------------------------------------------*/
63 shiftDist = 0x433 - exp;
64 if ( shiftDist <= 0 ) {
65 /*--------------------------------------------------------------------
66 *--------------------------------------------------------------------*/
67 if ( shiftDist < -10 ) {
68 if ( uiA == packToF64UI( 1, 0x43E, 0 ) ) {
69 return -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1;
70 }
72 return
73 (exp == 0x7FF) && sig ? i64_fromNaN
75 }
76 /*--------------------------------------------------------------------
77 *--------------------------------------------------------------------*/
78 sig |= UINT64_C( 0x0010000000000000 );
79 absZ = sig<<-shiftDist;
80 } else {
81 /*--------------------------------------------------------------------
82 *--------------------------------------------------------------------*/
83 if ( 53 <= shiftDist ) {
84 if ( exact && (exp | sig) ) {
86 }
87 return 0;
88 }
89 /*--------------------------------------------------------------------
90 *--------------------------------------------------------------------*/
91 sig |= UINT64_C( 0x0010000000000000 );
92 absZ = sig>>shiftDist;
93 if ( exact && (absZ<<shiftDist != sig) ) {
95 }
96 }
97 return sign ? -absZ : absZ;
98
99}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
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 signF64UI(a)
Definition internals.h:125
#define packToF64UI(sign, exp, sig)
Definition internals.h:128
#define expF64UI(a)
Definition internals.h:126
#define fracF64UI(a)
Definition internals.h:127
@ softfloat_flag_invalid
Definition softfloat.h:89
@ softfloat_flag_inexact
Definition softfloat.h:85
THREAD_LOCAL uint_fast8_t softfloat_exceptionFlags
#define INT64_C(val)
Definition stdint.h:279
uint64_t uint_fast64_t
Definition stdint.h:157
#define UINT64_C(val)
Definition stdint.h:284
int16_t int_fast16_t
Definition stdint.h:151
int64_t int_fast64_t
Definition stdint.h:153
float64_t f
Definition internals.h:47
Here is the call graph for this function: