diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-01-14 14:48:00 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-01-14 14:48:00 -0500 |
commit | b169c8c14f23394b40305f38ee4ce08add278e27 (patch) | |
tree | 0649da16a97792103773f9d5cedbfd75deac49bd /src/lib/math/fp.c | |
parent | 691dec5d4615dec9a845d0f7dea7ef55cc66fe62 (diff) | |
parent | b269ab5aaeee65a3a0b1e5e0923d9dc7898c232e (diff) | |
download | tor-b169c8c14f23394b40305f38ee4ce08add278e27.tar.gz tor-b169c8c14f23394b40305f38ee4ce08add278e27.zip |
Merge remote-tracking branch 'asn-github/adaptive_padding-final'
Diffstat (limited to 'src/lib/math/fp.c')
-rw-r--r-- | src/lib/math/fp.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/math/fp.c b/src/lib/math/fp.c index d5989db637..57082fa468 100644 --- a/src/lib/math/fp.c +++ b/src/lib/math/fp.c @@ -117,3 +117,28 @@ ENABLE_GCC_WARNING(double-promotion) ENABLE_GCC_WARNING(float-conversion) #endif } + +/* isinf() wrapper for tor */ +int +tor_isinf(double x) +{ + /* Same as above, work around the "double promotion" warnings */ +#if defined(MINGW_ANY) && GCC_VERSION >= 409 +#define PROBLEMATIC_FLOAT_CONVERSION_WARNING +DISABLE_GCC_WARNING(float-conversion) +#endif /* defined(MINGW_ANY) && GCC_VERSION >= 409 */ +#if defined(__clang__) +#if __has_warning("-Wdouble-promotion") +#define PROBLEMATIC_DOUBLE_PROMOTION_WARNING +DISABLE_GCC_WARNING(double-promotion) +#endif +#endif /* defined(__clang__) */ + return isinf(x); +#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING +ENABLE_GCC_WARNING(double-promotion) +#endif +#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING +ENABLE_GCC_WARNING(float-conversion) +#endif +} + |