[sim] made softfloat files C instead of C++
[riscv-isa-sim.git] / softfloat / s_normRoundPackToF64.c
1
2 #include <stdbool.h>
3 #include <stdint.h>
4 #include "platform.h"
5 #include "primitives.h"
6 #include "internals.h"
7
8 float64_t
9 softfloat_normRoundPackToF64( bool sign, int_fast16_t exp, uint_fast64_t sig )
10 {
11 int shiftCount;
12 union ui64_f64 uZ;
13
14 shiftCount = softfloat_countLeadingZeros64( sig ) - 1;
15 exp -= shiftCount;
16 if ( ( 10 <= shiftCount ) && ( (uint16_t) exp < 0x7FD ) ) {
17 uZ.ui = packToF64UI( sign, sig ? exp : 0, sig<<( shiftCount - 10 ) );
18 return uZ.f;
19 } else {
20 return softfloat_roundPackToF64( sign, exp, sig<<shiftCount );
21 }
22
23 }
24