[FFmpeg-cvslog] r12165 - trunk/libavcodec/dsputil.c
Måns Rullgård
mans
Thu Feb 21 22:20:00 CET 2008
Uoti Urpala <uoti.urpala at pp1.inet.fi> writes:
> 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;
This assumes two's complement signed numbers. Using ~0UL avoids this
assumption.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-cvslog
mailing list