[MPlayer-dev-eng] about log2 replacement

Chang Chen Chang_Chen at sonic.com
Mon Aug 10 08:01:52 CEST 2009


I use cygwin, here are log2 checking algorithm from configure

  #include<math.h>

  int  main (void)
  { 
    long(*foo)(float);
    foo = log2;
    Void(*foo)(0.0);
    return 0.0;
  }

Since log2 is defined as a macro, HAVE_LOG2 is 0.

In the compilation(libavutil/internal.h)

  static av_always_inline av_const double log2(double x)
  {
     return log(x)*1.44269;
  }

Here log2 will be explained as a macro, hence gcc reports an error

Interesting, if I change -std=gnu99 to -std=c99, then build is ok!

Thanks
Chang 
-----Original Message-----
From: mplayer-dev-eng-bounces at mplayerhq.hu
[mailto:mplayer-dev-eng-bounces at mplayerhq.hu] On Behalf Of Uoti Urpala
Sent: Monday, August 10, 2009 1:04 PM
To: mplayer-dev-eng at mplayerhq.hu
Subject: Re: [MPlayer-dev-eng] about log2 replacement

On Mon, 2009-08-10 at 12:30 +0800, Chang Chen wrote:
> In r19395 of libavutil/internal.h, alexc added a inline function for
> log2.
> 
>  
> 
> ~~log2~~ isn't c99 standard, but it is defined a macro with build flag
> -std=gnu99.

It is standard.

> ffmpeg use -std=c99,  so this works, but mplayer use -std=gnu99, so
> build is broen

Not only is the function standard, but the configure script checks
whether it exists and sets the HAVE_LOG2 variable accordingly, so
compilation should work as long as the flags during the test and use are
the same. Also it's been a month since that change and other people
haven't reported related problems.

> any suggestion for how to fix this issue?

What exactly is the problem you have? As described above -std=c99 vs
-std=gnu99 should not cause any problems.

_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng



More information about the MPlayer-dev-eng mailing list