[FFmpeg-devel] [PATCH] Fix warnings about int64toint32conversion

Michael Bradshaw mbradshaw at sorensonmedia.com
Wed May 16 20:26:04 CEST 2012

On Wed, May 16, 2012 at 12:14 PM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Wed, May 16, 2012 at 12:05:13PM -0600, Michael Bradshaw wrote:
>> Wow, this turned into a lively discussion.
>> To answer some of the questions: these warnings are from MSVC 2008 and
>> 2010 (haven't tested other versions). Yes, two of the casts are
>> technically unnecessary (read below). I have tested this with gcc
>> 4.2.1 with a random sampling of 1000000 integers, and the output is
>> the same before and after the patch.
>> I've attached a new version of the patch that removes the two
>> unnecessary casts. I originally added them because a) I have a habit
>> of being explicit when demoting data types and b) for consistency. I
>> think you have a valid point Reimar that they probably shouldn't be
>> included in this patch, though, and MSVC 2008 and 2010 don't complain
>> if the two casts are removed.
>> Let me know if this patch is better.
> I have no objections against this one.
> I might be useful to add a comment that the casts are only there to
> silence warnings and that the numbers already fit into 32 bit

Actually, there's no guarantee that x fits into a 32 bit int when
av_popcount(x) is called. Just thought I'd mention that.



More information about the ffmpeg-devel mailing list