summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-06-09 12:56:35 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2010-06-09 12:56:35 +0000
commita83169cd671ac6aa5583e0679c94e84051df3675 (patch)
treef236884d1821a2340e632d7e6e3a973a81059b85 /libgfortran
parentb807f4f826c9d1ddf96df2ed54f6e6fe94f3df6a (diff)
downloadgcc-a83169cd671ac6aa5583e0679c94e84051df3675.tar.gz
mk-kinds-h.sh: Define GFC_REAL_*_LITERAL_SUFFIX and GFC_REAL_*_LITERAL macros for each kind.
* mk-kinds-h.sh: Define GFC_REAL_*_LITERAL_SUFFIX and GFC_REAL_*_LITERAL macros for each kind. * intrinsics/cpu_time.c (cpu_time_4, cpu_time_8, cpu_time_10, cpu_time_16): Use them. * intrinsics/random.c (rnumber_4, rnumber_8, rnumber_10, rnumber_16): Likewise. From-SVN: r160470
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/intrinsics/cpu_time.c8
-rw-r--r--libgfortran/intrinsics/random.c10
-rwxr-xr-xlibgfortran/mk-kinds-h.sh6
4 files changed, 24 insertions, 9 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index d2acafd0945..f71567d7d42 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,5 +1,14 @@
2010-06-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+ * mk-kinds-h.sh: Define GFC_REAL_*_LITERAL_SUFFIX and
+ GFC_REAL_*_LITERAL macros for each kind.
+ * intrinsics/cpu_time.c (cpu_time_4, cpu_time_8, cpu_time_10,
+ cpu_time_16): Use them.
+ * intrinsics/random.c (rnumber_4, rnumber_8, rnumber_10,
+ rnumber_16): Likewise.
+
+2010-06-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
* intrinsics/system_clock.c (system_clock_4, system_clock_8):
Undefine TCK.
diff --git a/libgfortran/intrinsics/cpu_time.c b/libgfortran/intrinsics/cpu_time.c
index 0ac502340ac..3580bba0928 100644
--- a/libgfortran/intrinsics/cpu_time.c
+++ b/libgfortran/intrinsics/cpu_time.c
@@ -78,7 +78,7 @@ void cpu_time_4 (GFC_REAL_4 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_4)1.e-6;
+ *time = sec + usec * GFC_REAL_4_LITERAL(1.e-6);
}
iexport(cpu_time_4);
@@ -89,7 +89,7 @@ void cpu_time_8 (GFC_REAL_8 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_8)1.e-6;
+ *time = sec + usec * GFC_REAL_8_LITERAL(1.e-6);
}
#ifdef HAVE_GFC_REAL_10
@@ -100,7 +100,7 @@ void cpu_time_10 (GFC_REAL_10 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_10)1.e-6;
+ *time = sec + usec * GFC_REAL_10_LITERAL(1.e-6);
}
#endif
@@ -112,7 +112,7 @@ void cpu_time_16 (GFC_REAL_16 *time)
{
long sec, usec;
__cpu_time_1 (&sec, &usec);
- *time = sec + usec * (GFC_REAL_16)1.e-6;
+ *time = sec + usec * GFC_REAL_16_LITERAL(1.e-6);
}
#endif
diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c
index 803049b065f..cbe4f90322b 100644
--- a/libgfortran/intrinsics/random.c
+++ b/libgfortran/intrinsics/random.c
@@ -85,7 +85,7 @@ rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v)
#error "GFC_REAL_4_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_4) v * (GFC_REAL_4) 0x1.p-32f;
+ *f = (GFC_REAL_4) v * GFC_REAL_4_LITERAL(0x1.p-32);
}
static inline void
@@ -100,7 +100,7 @@ rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v)
#error "GFC_REAL_8_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_8) v * (GFC_REAL_8) 0x1.p-64;
+ *f = (GFC_REAL_8) v * GFC_REAL_8_LITERAL(0x1.p-64);
}
#ifdef HAVE_GFC_REAL_10
@@ -117,7 +117,7 @@ rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v)
#error "GFC_REAL_10_RADIX has unknown value"
#endif
v = v & mask;
- *f = (GFC_REAL_10) v * (GFC_REAL_10) 0x1.p-64;
+ *f = (GFC_REAL_10) v * GFC_REAL_10_LITERAL(0x1.p-64);
}
#endif
@@ -137,8 +137,8 @@ rnumber_16 (GFC_REAL_16 *f, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2)
#error "GFC_REAL_16_RADIX has unknown value"
#endif
v2 = v2 & mask;
- *f = (GFC_REAL_16) v1 * (GFC_REAL_16) 0x1.p-64
- + (GFC_REAL_16) v2 * (GFC_REAL_16) 0x1.p-128;
+ *f = (GFC_REAL_16) v1 * GFC_REAL_16_LITERAL(0x1.p-64)
+ + (GFC_REAL_16) v2 * GFC_REAL_16_LITERAL(0x1.p-128);
}
#endif
/* libgfortran previously had a Mersenne Twister, taken from the paper:
diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh
index c5d20fe12c5..a16f9850254 100755
--- a/libgfortran/mk-kinds-h.sh
+++ b/libgfortran/mk-kinds-h.sh
@@ -82,6 +82,12 @@ for k in $possible_real_kinds; do
echo "#define HAVE_GFC_REAL_${k}"
echo "#define HAVE_GFC_COMPLEX_${k}"
echo "#define GFC_REAL_${k}_HUGE ${huge}${suffix}"
+ echo "#define GFC_REAL_${k}_LITERAL_SUFFIX ${suffix}"
+ if [ "x$suffix" = "x" ]; then
+ echo "#define GFC_REAL_${k}_LITERAL(X) (X)"
+ else
+ echo "#define GFC_REAL_${k}_LITERAL(X) (X ## ${suffix})"
+ fi
echo "#define GFC_REAL_${k}_DIGITS ${digits}"
echo "#define GFC_REAL_${k}_RADIX ${radix}"
echo ""