view dmd/Port.d @ 191:52188e7e3fb5

Fixed deprecated features, now compiles with DMD2.058 Also changed Array allocation policy: Now doesn't reallocate but malloc's, followed by a memcpy (no free). (this fixes a crash while compiling druntime. Same bug in dmd)
author korDen@korDen-pc
date Sun, 25 Mar 2012 03:11:12 +0400
parents e28b18c23469
children
line wrap: on
line source

module dmd.Port;

import dmd.common;
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);
	}
}