diff dmd/Port.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children e28b18c23469
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmd/Port.d	Sat Oct 24 08:42:06 2009 +0400
@@ -0,0 +1,22 @@
+module dmd.Port;
+
+import core.stdc.math;
+
+struct Port
+{
+    static int isSignallingNan(double r)
+	{
+		/* A signalling NaN is a NaN with 0 as the most significant bit of
+		 * its significand, which is bit 51 of 0..63 for 64 bit doubles.
+		 */
+		return isnan(r) && !(((cast(ubyte*)&r)[6]) & 8);
+	}
+	
+    static int isSignallingNan(ref real r)
+	{
+		/* A signalling NaN is a NaN with 0 as the most significant bit of
+		 * its significand, which is bit 62 of 0..79 for 80 bit reals.
+		 */
+		return isnan(r) && !(((cast(ubyte*)&r)[7]) & 0x40);
+	}
+}
\ No newline at end of file