On Tue, Nov 25, 2014 at 1:54 AM, Vittorio Giovara
<[email protected]> wrote:
> Also reduce variable scope.
>
> CC: [email protected]
> Bug-Id: CID 1238835
> ---
> This version produces exactly the same values as before, assuming that
> the original intent was having an integer division. Rough test program
> http://www.privatepaste.com/9b8ea5d86a
>
> Vittorio
>
>  libavcodec/mpegaudio_tablegen.h | 4 ++--
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
> index 8a3e51a..4d391e6 100644
> --- a/libavcodec/mpegaudio_tablegen.h
> +++ b/libavcodec/mpegaudio_tablegen.h
> @@ -42,13 +42,13 @@ static float expval_table_float[512][16];
>
>  static void mpegaudio_tableinit(void)
>  {
> -    int i, value, exponent;
> +    int i, exponent;
>      for (i = 1; i < TABLE_4_3_SIZE; i++) {
> -        double value = i / 4;
> +        int value = i / 4;
>          double f, fm;
>          int e, m;
>          /* cbrtf() isn't available on all systems, so we use powf(). */
> -        f  = value * powf(value, 1.0 / 3.0) * pow(2, (i & 3) * 0.25);
> +        f  = powf(value, 1.0 / 3.0) * pow(2, (i & 3) * 0.25) * value;

btw this change is required only for clang, gcc provides the same
results without changing order of operands.

-- 
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to