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

Deepthi Nandakumar deepthi at multicorewareinc.com
Tue Sep 17 16:50:22 CEST 2013


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.


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130917/bb714ab0/attachment.html>


More information about the x265-devel mailing list