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

Go to the source code of this file.

Functions

int_fast32_t f16_to_i32_r_minMag (float16_t a, bool exact)
 

Function Documentation

◆ f16_to_i32_r_minMag()

int_fast32_t f16_to_i32_r_minMag ( float16_t a,
bool exact )

Definition at line 44 of file f16_to_i32_r_minMag.c.

45{
46 union ui16_f16 uA;
47 uint_fast16_t uiA;
48 int_fast8_t exp;
49 uint_fast16_t frac;
50 int_fast8_t shiftDist;
51 bool sign;
52 int_fast32_t alignedSig;
53
54 /*------------------------------------------------------------------------
55 *------------------------------------------------------------------------*/
56 uA.f = a;
57 uiA = uA.ui;
58 exp = expF16UI( uiA );
59 frac = fracF16UI( uiA );
60 /*------------------------------------------------------------------------
61 *------------------------------------------------------------------------*/
62 shiftDist = exp - 0x0F;
63 if ( shiftDist < 0 ) {
64 if ( exact && (exp | frac) ) {
66 }
67 return 0;
68 }
69 /*------------------------------------------------------------------------
70 *------------------------------------------------------------------------*/
71 sign = signF16UI( uiA );
72 if ( exp == 0x1F ) {
74 return
75 (exp == 0x1F) && frac ? i32_fromNaN
77 }
78 /*------------------------------------------------------------------------
79 *------------------------------------------------------------------------*/
80 alignedSig = (int_fast32_t) (frac | 0x0400)<<shiftDist;
81 if ( exact && (alignedSig & 0x3FF) ) {
83 }
84 alignedSig >>= 10;
85 return sign ? -alignedSig : alignedSig;
86
87}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
void softfloat_raiseFlags(uint_fast8_t flags)
#define i32_fromNegOverflow
Definition specialize.h:58
#define i32_fromNaN
Definition specialize.h:59
#define i32_fromPosOverflow
Definition specialize.h:57
#define expF16UI(a)
Definition internals.h:84
#define signF16UI(a)
Definition internals.h:83
#define fracF16UI(a)
Definition internals.h:85
@ 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
int8_t int_fast8_t
Definition stdint.h:150
int32_t int_fast32_t
Definition stdint.h:152
float16_t f
Definition internals.h:45
Here is the call graph for this function: