[FFmpeg-devel] [PATCH] Fix warnings about int64toint32conversion
Don Moir
donmoir at comcast.net
Mon May 21 19:16:29 CEST 2012
----- Original Message -----
From: "Michael Bradshaw" <mbradshaw at sorensonmedia.com>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Monday, May 21, 2012 12:56 PM
Subject: Re: [FFmpeg-devel] [PATCH] Fix warnings about
int64toint32conversion
> On Wed, May 16, 2012 at 12:05 PM, Michael Bradshaw
> <mbradshaw at sorensonmedia.com> 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.
>>
>> Thanks,
>>
>> Michael
>
> Ping.
>
> Reimar said he has no objections to this newer patch. Does anyone else?
Was av_cmp_q in rational.h taken care of ? Don't remember seeing that in
proposed patch.
static inline int av_cmp_q(AVRational a, AVRational b){
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
- if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1;
+ if(tmp) return (int)(((tmp ^ a.den ^ b.den)>>63)|1);
else if(b.den && a.den) return 0;
else if(a.num && b.num) return (a.num>>31) - (b.num>>31);
else return INT_MIN;
}
More information about the ffmpeg-devel
mailing list