[FFmpeg-cvslog] r12165 - trunk/libavcodec/dsputil.c

Rich Felker dalias
Thu Feb 21 22:18:30 CET 2008


On Thu, Feb 21, 2008 at 09:01:37PM +0200, Uoti Urpala wrote:
> On Thu, 2008-02-21 at 20:28 +0200, Uoti Urpala wrote:
> > On Thu, 2008-02-21 at 08:54 +0100, lorenm wrote:
> > > +static const unsigned long pb_7f = 0x7f7f7f7f7f7f7f7fUL;
> > > +static const unsigned long pb_80 = 0x8080808080808080UL;
> > 
> > I think these should have a comment about truncation on 32-bit platforms
> > being intentional. And the code will fail on a 128-bit platform :)
> 
> I forgot to add that these could be written in a way that is independent
> of sizeof(long) and doesn't cause compiler warnings about truncation on
> platforms with shorter longs:
> static const unsigned long pb_7f = -1UL/255 * 0x7f;
> That may need to comment too though, as it probably wouldn't be
> immediately obvious to all readers what it expands to.

I like this solution a lot. I'll adapt it to some of my own code where
gcc is giving the same idiotic truncation warning.

Rich




More information about the ffmpeg-cvslog mailing list