[flac-dev] PATCH: MSVC and M_LN2

lvqcl lvqcl.mail at gmail.com
Fri Aug 16 13:08:55 PDT 2013


math.h file in MS VC++ _does_ have M_LN2 constant but it requires _USE_MATH_DEFINES:

--- a\src\libFLAC\fixed.c	2013-08-13 13:30:24.000000000 +0400
+++ b\src\libFLAC\fixed.c	2013-08-14 10:14:07.873648300 +0400
@@ -34,6 +34,9 @@
  #  include <config.h>
  #endif

+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
  #include <math.h>
  #include <string.h>
  #include "private/bitmath.h"
@@ -42,7 +45,6 @@
  #include "FLAC/assert.h"

  #ifndef M_LN2
-/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
  #define M_LN2 0.69314718055994530942
  #endif

--- a\src\libFLAC\lpc.c	2013-08-13 13:30:24.000000000 +0400
+++ b\src\libFLAC\lpc.c	2013-08-06 19:17:00.765482100 +0400
@@ -34,6 +34,9 @@
  #  include <config.h>
  #endif

+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#endif
  #include <math.h>

  #include "FLAC/assert.h"
@@ -52,7 +55,6 @@
  #ifndef FLAC__INTEGER_ONLY_LIBRARY

  #ifndef M_LN2
-/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */
  #define M_LN2 0.69314718055994530942
  #endif


More information about the flac-dev mailing list