d0bd177c8d7eaba3955b9b22e81d04b76960c4b6
[riscv-isa-sim.git] / softfloat / ui32_to_f64.c
1
2 #include <stdint.h>
3 #include "platform.h"
4 #include "primitives.h"
5 #include "internals.h"
6 #include "softfloat.h"
7
8 float64_t ui32_to_f64( uint_fast32_t a )
9 {
10 uint_fast64_t uiZ;
11 int shiftCount;
12 union ui64_f64 uZ;
13
14 if ( ! a ) {
15 uiZ = 0;
16 } else {
17 shiftCount = softfloat_countLeadingZeros32( a ) + 21;
18 uiZ =
19 packToF64UI(
20 0, 0x432 - shiftCount, (uint_fast64_t) a<<shiftCount );
21 }
22 uZ.ui = uiZ;
23 return uZ.f;
24
25 }
26