annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.Port;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 0
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import core.stdc.math;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 struct Port
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 static int isSignallingNan(double r)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 /* A signalling NaN is a NaN with 0 as the most significant bit of
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 * its significand, which is bit 51 of 0..63 for 64 bit doubles.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 return isnan(r) && !(((cast(ubyte*)&r)[6]) & 8);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 static int isSignallingNan(ref real r)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 /* A signalling NaN is a NaN with 0 as the most significant bit of
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 * its significand, which is bit 62 of 0..79 for 80 bit reals.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 return isnan(r) && !(((cast(ubyte*)&r)[7]) & 0x40);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 }