[FFmpeg-cvslog] cpu detection: avoid a signed overflow

Sean McGovern git at videolan.org
Thu Sep 22 01:17:26 CEST 2011


ffmpeg | branch: release/0.8 | Sean McGovern <gseanmcg at gmail.com> | Mon Jul 25 18:51:02 2011 -0400| [fe9dae6df8be03ed5e62819ba98f16bfeb510abd] | committer: Anton Khirnov

cpu detection: avoid a signed overflow

1<<31 overflows because 1 is signed, so force it to unsigned.

Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
(cherry picked from commit 5938e02185430ca711106aaec9b5622dbf588af3)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavutil/x86/cpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
index 78aeadf..f747e4d 100644
--- a/libavutil/x86/cpu.c
+++ b/libavutil/x86/cpu.c
@@ -113,7 +113,7 @@ int ff_get_cpu_flags_x86(void)
 
     if(max_ext_level >= 0x80000001){
         cpuid(0x80000001, eax, ebx, ecx, ext_caps);
-        if (ext_caps & (1<<31))
+        if (ext_caps & (1U<<31))
             rval |= AV_CPU_FLAG_3DNOW;
         if (ext_caps & (1<<30))
             rval |= AV_CPU_FLAG_3DNOWEXT;



More information about the ffmpeg-cvslog mailing list