[flac-dev] uint64 -> double conversion
lvqcl
lvqcl.mail at gmail.com
Wed Jul 2 07:36:09 PDT 2014
Anybody knows the reason for the following code
(you can see it in flac/decode.c, flac/encode.c, libFLAC/fixed.c and
libFLAC/stream_decoder.c) ?
#if defined _MSC_VER || defined __MINGW32__
/* with MSVC you have to spoon feed it the casting */
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
...
#else
residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0);
...
#endif
IOW: use (FLAC__double)(FLAC__int64)some_uint64_variable for MSVC and MinGW
and (FLAC__double)some_uint64_variable for other compilers.
relevant patches:
http://git.xiph.org/?p=flac.git;a=commitdiff;h=59f4a995ddf0632241116bd69f6dc8c6f3ac790c
(april 2001)
http://git.xiph.org/?p=flac.git;a=commitdiff;h=40333b13c127bfb3c5f839fb59edbafa23d3ccbb
(this patch is probably just a mass rename from _MSC_VER to _MSC_VER + __MINGW32__).
Is it MSVC6 specific? The following web pages seem to confirm this:
http://www.winehq.org/pipermail/wine-patches/2004-September/012502.html
https://mail.gnome.org/archives/commits-list/2012-July/msg01092.html
More information about the flac-dev
mailing list