Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
i64_to_f32.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "softfloat.h"
Include dependency graph for i64_to_f32.c:

Go to the source code of this file.

Functions

float32_t i64_to_f32 (int64_t a)
 

Function Documentation

◆ i64_to_f32()

float32_t i64_to_f32 ( int64_t a)

Definition at line 43 of file i64_to_f32.c.

44{
45 bool sign;
46 uint_fast64_t absA;
47 int_fast8_t shiftDist;
48 union ui32_f32 u;
49 uint_fast32_t sig;
50
51 sign = (a < 0);
52 absA = sign ? -(uint_fast64_t) a : (uint_fast64_t) a;
53 shiftDist = softfloat_countLeadingZeros64( absA ) - 40;
54 if ( 0 <= shiftDist ) {
55 u.ui =
56 a ? packToF32UI(
57 sign, 0x95 - shiftDist, (uint_fast32_t) absA<<shiftDist )
58 : 0;
59 return u.f;
60 } else {
61 shiftDist += 7;
62 sig =
63 (shiftDist < 0)
64 ? softfloat_shortShiftRightJam64( absA, -shiftDist )
65 : (uint_fast32_t) absA<<shiftDist;
66 return softfloat_roundPackToF32( sign, 0x9C - shiftDist, sig );
67 }
68
69}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
float32_t softfloat_roundPackToF32(bool, int_fast16_t, uint_fast32_t)
#define packToF32UI(sign, exp, sig)
Definition internals.h:107
uint64_t softfloat_shortShiftRightJam64(uint64_t a, uint_fast8_t dist)
#define softfloat_countLeadingZeros64
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
uint32_t uint_fast32_t
Definition stdint.h:156
Here is the call graph for this function: