temporary undoing of renaming
[riscv-isa-sim.git] / softfloat / ui64_to_f32.c
1
2 #include <stdint.h>
3 #include "platform.h"
4 #include "primitives.h"
5 #include "internals.h"
6 #include "softfloat.h"
7
8 float32_t ui64_to_f32( uint_fast64_t a )
9 {
10 int shiftCount;
11 union ui32_f32 u;
12 uint_fast32_t sig;
13
14 shiftCount = softfloat_countLeadingZeros64( a ) - 40;
15 if ( 0 <= shiftCount ) {
16 u.ui =
17 a ? packToF32UI(
18 0, 0x95 - shiftCount, (uint_fast32_t) a<<shiftCount )
19 : 0;
20 return u.f;
21 } else {
22 shiftCount += 7;
23 sig =
24 ( shiftCount < 0 )
25 ? softfloat_shortShift64RightJam( a, - shiftCount )
26 : (uint_fast32_t) a<<shiftCount;
27 return softfloat_roundPackToF32( 0, 0x9C - shiftCount, sig );
28 }
29
30 }
31