[flac-dev] New routine: FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_16

lvqcl lvqcl.mail at gmail.com
Sun Sep 1 08:25:28 PDT 2013

Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:

> Well first of all, none of them apply :-).

I'll try to redo the necessary patches with git.

> * Remove restrict definition from include/share/compat.h. Applied.

BTW, I tried to use 'restrict' keyword with MSVS 2010 and 2012 and in fact they don't support it. Only --restrict is supported.

> * libFLAC and FLAC__ALIGN_MALLOC_DATA : Looks sane but doesn't apply.
> * MSVC and M_LN2 : Looks sane but doesn't apply.

It is also possible to add /D "_USE_MATH_DEFINES" as an additional option to libFLAC_static.vcproj and libFLAC_dynamic.vcproj. Don't know what is better. What do you think?

> * bitmath.h: 1 typo, 1 warning : I don't see why the type has to change.

Declarations from MSDN:
     unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask);
     unsigned char _BitScanReverse64(unsigned long * Index, unsigned __int64 Mask);

FLAC uses them as:
     _BitScanReverse(FLAC__uint32* idx, FLAC__uint32 v);
     _BitScanReverse64(FLAC__uint64* idx, FLAC__uint64 v);

AFAIK unsigned long is not the same type as FLAC__uint32 (= unsigned int) but it doesn't really matter since both of them are 4-byte unsigned integers.

However, _BitScanReverse64 expects a pointer to a 4-byte uint, but it is called with a pointer to a 8-byte uint. The garbage in the most significant 4 bytes of idx is discarded then and the result of FLAC__bitmath_ilog2_wide() is correct. Still I think it's a bug.

Also I noticed that all projects with '_static' suffix produce static library files (*.lib), projects with '_dynamic' suffix produce dynamic library files (*.dll), and projects without suffixes produce executables (*.exe). The only exception is win_utf8_io. Should it be renamed to win_utf8_io_static?

More information about the flac-dev mailing list