summaryrefslogtreecommitdiff
path: root/ext/fputils/tests/fp80_cvtd.c
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2013-10-01 15:19:56 +0200
committerAndreas Sandberg <andreas@sandberg.pp.se>2013-10-01 15:19:56 +0200
commit7c52865d1bd63e4b3a4352d6178a391e1b0ed29d (patch)
tree32432ea31bafd089966fbf9e66fa73c5f627c6fb /ext/fputils/tests/fp80_cvtd.c
parentfec2dea5c35d830ab4f4dc5295e6dba0e152f18e (diff)
downloadgem5-7c52865d1bd63e4b3a4352d6178a391e1b0ed29d.tar.xz
ext: Update fputils to rev 52b6190b4e
This changeset updates the external library to git revision 52b6190b4e. This update includes changes that fix compilation errors on old gcc versions and fixes to test a case that affect ICC.
Diffstat (limited to 'ext/fputils/tests/fp80_cvtd.c')
-rw-r--r--ext/fputils/tests/fp80_cvtd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/fputils/tests/fp80_cvtd.c b/ext/fputils/tests/fp80_cvtd.c
index 425a5c44a..5a49d3426 100644
--- a/ext/fputils/tests/fp80_cvtd.c
+++ b/ext/fputils/tests/fp80_cvtd.c
@@ -35,6 +35,15 @@
#include <stdio.h>
#include <stdlib.h>
+/* We provide our own version of isinf_sgn since the C99 standard
+ * doesn't guarantee that isinf() returns the sign of the infinity
+ * (most implementations do). */
+static inline int
+isinf_sgn(double x)
+{
+ return isinf(x) ? (signbit(x) ? -1 : 1) : 0;
+}
+
static void
test_fp80_cvtd_class(const char *name, fp80_t fin, int class)
{
@@ -48,10 +57,10 @@ test_fp80_cvtd_class(const char *name, fp80_t fin, int class)
}
static void
-test_fp80_cvtd_inf(const char *name, fp80_t fin, int inf_class)
+test_fp80_cvtd_inf(const char *name, fp80_t fin, int expected_inf_class)
{
double d = fp80_cvtd(fin);
- if (isinf(d) != inf_class) {
+ if (isinf_sgn(d) != expected_inf_class) {
test_diag("wrong infinity type");
test_fail(name);
} else {