[sim] integrated SoftFloat-3 with ISA sim; removed SoftFloat-2b
[riscv-isa-sim.git] / softfloat / ui32_to_f64.cc
diff --git a/softfloat/ui32_to_f64.cc b/softfloat/ui32_to_f64.cc
new file mode 100755 (executable)
index 0000000..d0bd177
--- /dev/null
@@ -0,0 +1,26 @@
+\r
+#include <stdint.h>\r
+#include "platform.h"\r
+#include "primitives.h"\r
+#include "internals.h"\r
+#include "softfloat.h"\r
+\r
+float64_t ui32_to_f64( uint_fast32_t a )\r
+{\r
+    uint_fast64_t uiZ;\r
+    int shiftCount;\r
+    union ui64_f64 uZ;\r
+\r
+    if ( ! a ) {\r
+        uiZ = 0;\r
+    } else {\r
+        shiftCount = softfloat_countLeadingZeros32( a ) + 21;\r
+        uiZ =\r
+            packToF64UI(\r
+                0, 0x432 - shiftCount, (uint_fast64_t) a<<shiftCount );\r
+    }\r
+    uZ.ui = uiZ;\r
+    return uZ.f;\r
+\r
+}\r
+\r