diff options
author | Thomas Habets <thomas@habets.se> | 2020-05-18 22:02:30 +0100 |
---|---|---|
committer | Martin Braun <martin@gnuradio.org> | 2020-05-21 10:46:58 -0700 |
commit | de5c0123e81329e1a8f6611edeac14062114af0c (patch) | |
tree | 80d7e6891675ac0d398e3e0453645023882af00b /cmake/msvc/config.h | |
parent | 4aa2ff61959a0005f50d9f591a76e69c2d3cbc34 (diff) |
gr-blocks/peak_detector: Remove UB on infinities
This code fixes two issues:
1. The code used `::min()` in one place, and "minus infinity" in
another, for the same purpose.
2. It used minus infinity on integer types, which is undefined
behavior.
(1) seems to have been accidentally left out of
9d9ea63c45b5f314eb344a69340ef49e8edafdfa.
(2)
Section 4.9:
> The behavior is undefined if the truncated value cannot be
> represented in the destination type.
And trunc() on infinity is still infinity, which can't be represented
in integer types.
Diffstat (limited to 'cmake/msvc/config.h')
-rw-r--r-- | cmake/msvc/config.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h index 68f716e8a6..a055f59fe8 100644 --- a/cmake/msvc/config.h +++ b/cmake/msvc/config.h @@ -41,14 +41,6 @@ static inline float rintf(float x) #endif //////////////////////////////////////////////////////////////////////// -// math constants -//////////////////////////////////////////////////////////////////////// -#if _MSC_VER < 1800 -#include <math.h> -#define INFINITY HUGE_VAL -#endif - -//////////////////////////////////////////////////////////////////////// // random and srandom //////////////////////////////////////////////////////////////////////// #include <stdlib.h> |