2016-05-04 4:59 GMT+02:00 Vittorio Giovara <vittorio.giov...@gmail.com>:
>> #if GNU_SOMETHING
>>
>> #define bitstream_read(ctx, len) \
>>   (__builtin_constant_p(len) ? ((len) <  0 ? barf() : \
>>                                 (len) == 0 ? 0 : \
>>                                 (len) == 1 ? bitstream_read_bit(ctx) : \
>>                                 (len) < 32 ? bitstream_read_32((ctx), (len)) 
>> : \
>>                                 (len) < 64 ? bitstream_read_63((ctx), (len)) 
>> : \
>>                                 barf()) : \
>>    bitstream_read_63((ctx), (len)))
>>
>> #else
>>
>> #define bitstream_read(ctx, len) bitstream_read_63((ctx), (len))
>>
>> #endif
>>
>> ?
>>
>> Cases where performance is very important can choose the correct inner 
>> function as appropriate.  Everyone else will usually get the right one 
>> anyway, and not have to be careful about the internals and exactly how wide 
>> things are.
>>
>> (Also maybe something microsofty as another variant, I don't know how that 
>> works.)
>
> I like this idea very very much.


Absolutely.

Except I fear only gcc and clang support it or an equivalent.

-- 
Christophe
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to