temporary undoing of renaming
[riscv-isa-sim.git] / softfloat / s_normRoundPackToF32.c
diff --git a/softfloat/s_normRoundPackToF32.c b/softfloat/s_normRoundPackToF32.c
new file mode 100755 (executable)
index 0000000..2e6f4b0
--- /dev/null
@@ -0,0 +1,24 @@
+\r
+#include <stdbool.h>\r
+#include <stdint.h>\r
+#include "platform.h"\r
+#include "primitives.h"\r
+#include "internals.h"\r
+\r
+float32_t\r
+ softfloat_normRoundPackToF32( bool sign, int_fast16_t exp, uint_fast32_t sig )\r
+{\r
+    int shiftCount;\r
+    union ui32_f32 uZ;\r
+\r
+    shiftCount = softfloat_countLeadingZeros32( sig ) - 1;\r
+    exp -= shiftCount;\r
+    if ( ( 7 <= shiftCount ) && ( (uint16_t) exp < 0xFD ) ) {\r
+        uZ.ui = packToF32UI( sign, sig ? exp : 0, sig<<( shiftCount - 7 ) );\r
+        return uZ.f;\r
+    } else {\r
+        return softfloat_roundPackToF32( sign, exp, sig<<shiftCount );\r
+    }\r
+\r
+}\r
+\r