[FFmpeg-devel] llvm failure : don't do undefined shift

Måns Rullgård mans
Fri Aug 21 14:57:35 CEST 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Thu, Aug 20, 2009 at 08:10:57PM +0200, Reimar D?ffinger wrote:
>> On Thu, Aug 20, 2009 at 05:52:25PM +0000, matthieu castet wrote:
>> > I don't know how to fix this, I only found strange that we have "if (n <
>> > bit_left) {" instead of "if (n <= bit_left) {"
>> 
>> So it gets written as soon as possible.
>> Anyway one solution is the same as for the le case which uses:
>>         bit_buf = (bit_left==32)?0:value >> bit_left;
>> (just that it is  bit_buf = (bit_left==32)?0:bit_buf << bit_left; )
>
> do we allow put_bits(32) at all? because it seems this can only happen
> in that case
> theres a assert(n==32 || ... that points to it being allowed but we also
> do have code like:
>                 put_bits(&s->pb, 16, 0);
>                 put_bits(&s->pb, 16, 0x1C3);
>
> that clearly splits the put_bits()

Splitting it in the rare cases where exactly 32 is needed is probably
faster than checking every time.  Bear in mind that a lot of calls
have variable number of bits, so the compiler can't remove the check
even if we know it's always less than 32.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list