annotate dmd/Port.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children e28b18c23469
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
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 import core.stdc.math;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 struct Port
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 static int isSignallingNan(double r)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 /* A signalling NaN is a NaN with 0 as the most significant bit of
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 * its significand, which is bit 51 of 0..63 for 64 bit doubles.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 return isnan(r) && !(((cast(ubyte*)&r)[6]) & 8);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 static int isSignallingNan(ref real r)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 /* A signalling NaN is a NaN with 0 as the most significant bit of
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 * its significand, which is bit 62 of 0..79 for 80 bit reals.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 return isnan(r) && !(((cast(ubyte*)&r)[7]) & 0x40);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 }