On Thu, Sep 15, 2016 at 9:03 AM, Timothy Arceri
<timothy.arc...@collabora.com> wrote:
> +   const int bias[] = { -1, 1, 1 };
> +
> +   for (unsigned i = 0; i < ARRAY_SIZE(bias); i++) {
> +      iter_int = iter_int + bias[i];
> +
> +      switch (cond_op) {
> +      case nir_op_ige:
> +      case nir_op_ilt:
> +      case nir_op_ieq:
> +      case nir_op_ine:
> +         if (itest_interations(iter_int, step, limit, cond_op, initial_val,
> +                               limit_rhs)) {
> +            return iter_int;
> +         }
> +         break;
> +      case nir_op_uge:
> +      case nir_op_ult:
> +         if (utest_interations(iter_int, step, limit, cond_op,
> +                               (uint32_t) initial_val, limit_rhs)) {
> +            return iter_int;
> +         }
> +         break;
> +      default:
> +         return -1;
> +      }
> +   }

Can't this be easier written as:

for (int i = iter_int - 1; i <= iter_int + 1; ++i)
{
    switch (cond_op) {
    [...]
    if (itest_interations(i, step, limit, cond_op, initial_val, limit_rhs))
         return i;
[...]
?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to