[x265] [PATCH] lookahead: change const bool to const int, so can be used safely in loop counter

Steve Borho steve at borho.org
Wed Sep 18 04:37:07 CEST 2013


On Tue, Sep 17, 2013 at 9:50 AM, Deepthi Nandakumar <
deepthi at multicorewareinc.com> wrote:

> The idea behind this was to remove integer-type additions with bool
> variables. It likely works for all known cases, but would make the code
> cleaner.
>

Oh, I see.  Later in the function it does:

for (int i = 0; i < 1 + bBidir; i++)

in that case, all you need to do is change the type of bBidir to int.  The
other changes should be unnecessary.


>
> On Tue, Sep 17, 2013 at 4:54 PM, Derek Buitenhuis <
> derek.buitenhuis at gmail.com> wrote:
>
>> On 9/17/2013 11:52 AM, deepthi at multicorewareinc.com wrote:
>> > # HG changeset patch
>> > # User Deepthi Nandakumar <deepthi at multicorewareinc.com>
>> > # Date 1379415109 -19800
>> > # Node ID defa0cb72646c483e7708e3f40a608e4be250818
>> > # Parent  0d33ff236f68bc2238138a7213301b2efc0e6426
>> > lookahead: change const bool to const int, so can be used safely in
>> loop counter.
>>
>> I'm not sure what the intended use is? Something a cast can't fix?
>>
>> > -    const bool bBidir = (b < p1);
>> > +    const int bBidir = (b < p1) ? 1 : 0;
>>
>> You don't need a branch here. (b < p1) will evaluate to 0 or 1,
>> since C++ is only weakly statically typed.
>>
>> > -    if (!bBidir)
>> > +    if (bBidir == 0)
>>
>> This isn't necessary, but it may be the convention in the codebase?
>>
>> - Derek
>>
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>>
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>


-- 
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130917/e337c2e4/attachment.html>


More information about the x265-devel mailing list