shithub: mc

Download patch

ref: 81bbd4c2bf2f3b7ccf53d2f46aef65f56e0ae7e5
parent: 064b5d2b2f9c54fcbd0e928d75253032e51f7e6f
author: Ori Bernstein <[email protected]>
date: Mon Jan 20 18:53:21 EST 2014

Add float bit conversion routines.

--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -12,6 +12,7 @@
     execvp.myr \
     extremum.myr \
     fmt.myr \
+    floatbits.myr \
     hashfuncs.myr \
     hasprefix.myr \
     hassuffix.myr \
--- /dev/null
+++ b/libstd/floatbits.myr
@@ -1,0 +1,10 @@
+pkg std =
+	const float64bits	: (flt : float64 -> uint64)
+	const float32bits	: (flt : float32 -> uint32)
+	const float64frombits	: (bits : uint64 -> float64)
+	const float32frombits	: (bits : uint32 -> float32)
+;;
+const float64bits	= {flt;	-> (&flt castto(uint64#))#}
+const float32bits	= {flt;	-> (&flt castto(uint32#))#}
+const float64frombits	= {bits;	-> (&bits castto(float64#))#}
+const float32frombits	= {bits;	-> (&bits castto(float32#))#}