[FFmpeg-cvslog] mathematics: Don't use division by zero in NAN/INFINITY macros
Ronald S. Bultje
git at videolan.org
Sun Jul 1 22:48:56 CEST 2012
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Jun 22 13:05:21 2012 +0300| [a1245d5ca1bed154a3bf38843b63018ae3544115] | committer: Martin Storsjö
mathematics: Don't use division by zero in NAN/INFINITY macros
Some compilers, MSVC among them, don't recognize the divisions by
zero as meaning infinity/nan.
These macros should, according to the standard, expand to constant
expressions, but this shouldn't matter for our usage.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1245d5ca1bed154a3bf38843b63018ae3544115
---
libavutil/mathematics.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index a734b75..043dd0f 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -25,6 +25,7 @@
#include <math.h>
#include "attributes.h"
#include "rational.h"
+#include "intfloat.h"
#ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
@@ -33,10 +34,10 @@
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */
#endif
#ifndef NAN
-#define NAN (0.0/0.0)
+#define NAN av_int2float(0x7fc00000)
#endif
#ifndef INFINITY
-#define INFINITY (1.0/0.0)
+#define INFINITY av_int2float(0x7f800000)
#endif
/**
More information about the ffmpeg-cvslog
mailing list