view dmd/Port.d @ 114:e28b18c23469

added a module dmd.common for commonly used stuff it currently holds code for consistency checking of predefined versions also added a VisualD project file
author Trass3r
date Wed, 01 Sep 2010 18:21:58 +0200
parents 10317f0c89a5
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);
	}
}