[FFmpeg-cvslog] avutil/libm: fix isnan compatibility hack

Ganesh Ajjanagadde git at videolan.org
Wed Nov 25 03:34:29 CET 2015


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Tue Nov 24 21:29:35 2015 -0500| [29af74e4e36daa3aa3ebafede844412d8cfff32b] | committer: Ganesh Ajjanagadde

avutil/libm: fix isnan compatibility hack

Commit 14ea4151d7c3c26500193f11ac661ed20c7c2b9c had a bug in that the
conversion of the uint64_t result to an int (the return signature) would
lead to implementation defined behavior, and in this case simply
returned 0 for NAN. A fix via AND'ing the result with 1 does the trick,
simply by ensuring a 0 or 1 return value.

Patch tested with FATE on x86-64, GNU/Linux by forcing the compatibility
code via an ifdef hack suggested by Michael.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29af74e4e36daa3aa3ebafede844412d8cfff32b
---

 libavutil/libm.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/libm.h b/libavutil/libm.h
index 9e5ec5d..6d8bd68 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -123,7 +123,7 @@ static av_always_inline av_const int avpriv_isnan(double x)
     uint64_t v = av_double2int(x);
     if ((v & 0x7ff0000000000000) != 0x7ff0000000000000)
         return 0;
-    return v & 0x000fffffffffffff;
+    return (v & 0x000fffffffffffff) && 1;
 }
 
 #define isnan(x)                  \



More information about the ffmpeg-cvslog mailing list