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@martin.st>
pull/59/head
Ronald S. Bultje 13 years ago committed by Martin Storsjö
parent 710bd8a33e
commit a1245d5ca1
  1. 5
      libavutil/mathematics.h

@ -25,6 +25,7 @@
#include <math.h> #include <math.h>
#include "attributes.h" #include "attributes.h"
#include "rational.h" #include "rational.h"
#include "intfloat.h"
#ifndef M_LOG2_10 #ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
@ -33,10 +34,10 @@
#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ #define M_PHI 1.61803398874989484820 /* phi / golden ratio */
#endif #endif
#ifndef NAN #ifndef NAN
#define NAN (0.0/0.0) #define NAN av_int2float(0x7fc00000)
#endif #endif
#ifndef INFINITY #ifndef INFINITY
#define INFINITY (1.0/0.0) #define INFINITY av_int2float(0x7f800000)
#endif #endif
/** /**

Loading…
Cancel
Save