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

Go to the source code of this file.

Functions

int_fast64_t f32_to_i64_r_minMag (float32_t a, bool exact)
 

Function Documentation

◆ f32_to_i64_r_minMag()

int_fast64_t f32_to_i64_r_minMag ( float32_t a,
bool exact )

Definition at line 44 of file f32_to_i64_r_minMag.c.

45{
46 union ui32_f32 uA;
47 uint_fast32_t uiA;
48 int_fast16_t exp;
49 uint_fast32_t sig;
50 int_fast16_t shiftDist;
51 bool sign;
52 uint_fast64_t sig64;
53 int_fast64_t absZ;
54
55 /*------------------------------------------------------------------------
56 *------------------------------------------------------------------------*/
57 uA.f = a;
58 uiA = uA.ui;
59 exp = expF32UI( uiA );
60 sig = fracF32UI( uiA );
61 /*------------------------------------------------------------------------
62 *------------------------------------------------------------------------*/
63 shiftDist = 0xBE - exp;
64 if ( 64 <= shiftDist ) {
65 if ( exact && (exp | sig) ) {
67 }
68 return 0;
69 }
70 /*------------------------------------------------------------------------
71 *------------------------------------------------------------------------*/
72 sign = signF32UI( uiA );
73 if ( shiftDist <= 0 ) {
74 if ( uiA == packToF32UI( 1, 0xBE, 0 ) ) {
75 return -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1;
76 }
78 return
79 (exp == 0xFF) && sig ? i64_fromNaN
81 }
82 /*------------------------------------------------------------------------
83 *------------------------------------------------------------------------*/
84 sig |= 0x00800000;
85 sig64 = (uint_fast64_t) sig<<40;
86 absZ = sig64>>shiftDist;
87 shiftDist = 40 - shiftDist;
88 if ( exact && (shiftDist < 0) && (uint32_t) (sig<<(shiftDist & 31)) ) {
90 }
91 return sign ? -absZ : absZ;
92
93}
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 expF32UI(a)
Definition internals.h:105
#define fracF32UI(a)
Definition internals.h:106
#define signF32UI(a)
Definition internals.h:104
#define packToF32UI(sign, exp, sig)
Definition internals.h:107
@ 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
unsigned int uint32_t
Definition stdint.h:126
uint64_t uint_fast64_t
Definition stdint.h:157
uint32_t uint_fast32_t
Definition stdint.h:156
int16_t int_fast16_t
Definition stdint.h:151
int64_t int_fast64_t
Definition stdint.h:153
float32_t f
Definition internals.h:46
Here is the call graph for this function: