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

Go to the source code of this file.

Functions

float128_t i64_to_f128 (int64_t a)
 

Function Documentation

◆ i64_to_f128()

float128_t i64_to_f128 ( int64_t a)

Definition at line 42 of file i64_to_f128.c.

43{
44 uint_fast64_t uiZ64, uiZ0;
45 bool sign;
46 uint_fast64_t absA;
47 int_fast8_t shiftDist;
48 struct uint128 zSig;
49 union ui128_f128 uZ;
50
51 if ( ! a ) {
52 uiZ64 = 0;
53 uiZ0 = 0;
54 } else {
55 sign = (a < 0);
56 absA = sign ? -(uint_fast64_t) a : (uint_fast64_t) a;
57 shiftDist = softfloat_countLeadingZeros64( absA ) + 49;
58 if ( 64 <= shiftDist ) {
59 zSig.v64 = absA<<(shiftDist - 64);
60 zSig.v0 = 0;
61 } else {
62 zSig = softfloat_shortShiftLeft128( 0, absA, shiftDist );
63 }
64 uiZ64 = packToF128UI64( sign, 0x406E - shiftDist, zSig.v64 );
65 uiZ0 = zSig.v0;
66 }
67 uZ.ui.v64 = uiZ64;
68 uZ.ui.v0 = uiZ0;
69 return uZ.f;
70
71}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
#define softfloat_countLeadingZeros64
struct uint128 softfloat_shortShiftLeft128(uint64_t a64, uint64_t a0, uint_fast8_t dist)
uint64_t uint_fast64_t
Definition stdint.h:157
int8_t int_fast8_t
Definition stdint.h:150
Here is the call graph for this function: