summaryrefslogtreecommitdiff
path: root/lib/isnanl.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-01-26 15:45:42 +0100
committerBruno Haible <bruno@clisp.org>2008-01-26 15:45:42 +0100
commit814389d96bd728c18fa658ae2ebb2ac72edd587a (patch)
treed58f080266e719fa528f8fc455c92b1c0d6117c1 /lib/isnanl.h
parent3e4b5182b4adda8d229d96e307a44a75eda086d3 (diff)
downloadgnulib-814389d96bd728c18fa658ae2ebb2ac72edd587a.tar.gz
Use the GCC built-in __builtin_isnanl (if it works).
Diffstat (limited to 'lib/isnanl.h')
-rw-r--r--lib/isnanl.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/isnanl.h b/lib/isnanl.h
index a79b040d58..36a733f9d2 100644
--- a/lib/isnanl.h
+++ b/lib/isnanl.h
@@ -1,5 +1,5 @@
/* Test for NaN.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,11 @@
#if HAVE_ISNANL
/* Get declaration of isnan macro or (older) isnanl function. */
# include <math.h>
-# ifdef isnan
+# if __GNUC__ >= 4
+ /* GCC 4.0 and newer provides three built-ins for isnan. */
+# undef isnanl
+# define isnanl(x) __builtin_isnanl ((long double)(x))
+# elif defined isnan
# undef isnanl
# define isnanl(x) isnan ((long double)(x))
# endif