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

Derek Buitenhuis derek.buitenhuis at gmail.com
Tue Sep 17 13:24:10 CEST 2013


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



More information about the x265-devel mailing list