[FFmpeg-devel] [PATCHv2] avutil/libm: correct isnan, isinf compat hacks

Michael Niedermayer michaelni at gmx.at
Wed Nov 18 20:58:41 CET 2015


On Tue, Nov 17, 2015 at 04:54:10PM -0500, Ganesh Ajjanagadde wrote:
> isnan and isinf are actually macros as per the standard. In particular,
> the existing implementation has incorrect signature. Furthermore, this
> results in undefined behavior for e.g double values outside float range
> as per the standard.
> 
> This patch corrects the undefined behavior for all usage within FFmpeg.
> 
> Note that long double is not handled as it is not used in FFmpeg.
> Furthermore, even if at some point long double gets used, it is likely
> not needed to modify the macro in practice for usage in FFmpeg. See
> below for analysis.
> 
> Getting long double to work strictly per the spec is significantly harder
> since a long double may be an IEEE 128 bit quad (very rare), 80 bit
> extended precision value (on GCC/Clang), or simply double (on recent Microsoft).
> On the other hand, any potential future usage of long double is likely
> for precision (when a platform offers extra precision) and not for range, since
> the range anyway varies and is not as portable as IEEE 754 single/double
> precision. In such cases, the implicit cast to a double is well defined
> and isinf and isnan should work as intended.
> 
> Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavutil/libm.h | 34 ++++++++++++++++++++++++++++++++--
>  1 file changed, 32 insertions(+), 2 deletions(-)

probably ok
maybe wait a day or 2 before pushing so people can test it on more
obscure platforms

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151118/c71aac8e/attachment.sig>


More information about the ffmpeg-devel mailing list