<p>It's a bit picky as compilers are likely to detect this themselves, but an 'inline' might be nice.</p>
<p>Nonetheless I'm in favor for everything that improves code readability, so:</p>
<p>Reviewed-By: Christoph Brill <<a href="mailto:egore911@gmail.com">egore911@gmail.com</a>></p>
<p>Am 17.03.2014 21:32 schrieb "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>>:<br>
><br>
> This is a little easier to read.<br>
><br>
> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
>  src/mesa/program/register_allocate.c | 13 +++++++++++--<br>
>  1 file changed, 11 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/mesa/program/register_allocate.c b/src/mesa/program/register_allocate.c<br>
> index edde730..c763b96 100644<br>
> --- a/src/mesa/program/register_allocate.c<br>
> +++ b/src/mesa/program/register_allocate.c<br>
> @@ -284,6 +284,15 @@ ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r)<br>
>  }<br>
><br>
>  /**<br>
> + * Returns true if the register belongs to the given class.<br>
> + */<br>
> +static bool<br>
> +reg_belongs_to_class(unsigned int r, struct ra_class *c)<br>
> +{<br>
> +   return c->regs[r];<br>
> +}<br>
> +<br>
> +/**<br>
>   * Must be called after all conflicts and register classes have been<br>
>   * set up and before the register set is used for allocation.<br>
>   * To avoid costly q value computation, use the q_values paramater<br>
> @@ -319,7 +328,7 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)<br>
>             int conflicts = 0;<br>
>             int i;<br>
><br>
> -           if (!regs->classes[c]->regs[rc])<br>
> +            if (!reg_belongs_to_class(rc, regs->classes[c]))<br>
>                continue;<br>
><br>
>             for (i = 0; i < regs->regs[rc].num_conflicts; i++) {<br>
> @@ -479,7 +488,7 @@ ra_select(struct ra_graph *g)<br>
>         */<br>
>        for (ri = 0; ri < g->regs->count; ri++) {<br>
>           r = (start_search_reg + ri) % g->regs->count;<br>
> -        if (!c->regs[r])<br>
> +         if (!reg_belongs_to_class(r, c))<br>
>             continue;<br>
><br>
>          /* Check if any of our neighbors conflict with this register choice. */<br>
> --<br>
> 1.9.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
</p>