[sim] made softfloat files C instead of C++
[riscv-isa-sim.git] / softfloat / s_normRoundPackToF64.c
diff --git a/softfloat/s_normRoundPackToF64.c b/softfloat/s_normRoundPackToF64.c
new file mode 100755 (executable)
index 0000000..64dced4
--- /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
+float64_t\r
+ softfloat_normRoundPackToF64( bool sign, int_fast16_t exp, uint_fast64_t sig )\r
+{\r
+    int shiftCount;\r
+    union ui64_f64 uZ;\r
+\r
+    shiftCount = softfloat_countLeadingZeros64( sig ) - 1;\r
+    exp -= shiftCount;\r
+    if ( ( 10 <= shiftCount ) && ( (uint16_t) exp < 0x7FD ) ) {\r
+        uZ.ui = packToF64UI( sign, sig ? exp : 0, sig<<( shiftCount - 10 ) );\r
+        return uZ.f;\r
+    } else {\r
+        return softfloat_roundPackToF64( sign, exp, sig<<shiftCount );\r
+    }\r
+\r
+}\r
+\r