[xcc] minor performance tweaks
[riscv-isa-sim.git] / softfloat / i32_to_f32.c
1
2 #include <stdbool.h>
3 #include <stdint.h>
4 #include "platform.h"
5 #include "internals.h"
6 #include "softfloat.h"
7
8 float32_t i32_to_f32( int_fast32_t a )
9 {
10 bool sign;
11 union ui32_f32 uZ;
12
13 sign = ( a < 0 );
14 if ( ! ( a & 0x7FFFFFFF ) ) {
15 uZ.ui = sign ? packToF32UI( 1, 0x9E, 0 ) : 0;
16 return uZ.f;
17 }
18 return softfloat_normRoundPackToF32( sign, 0x9C, sign ? - a : a );
19
20 }
21