[Mesa-dev] [PATCH 21/23] i965: Add helper function to find out the signedness of a register type.

Paul Berry stereotype441 at gmail.com
Mon Dec 30 10:41:35 PST 2013


On 2 December 2013 11:36, Francisco Jerez <currojerez at riseup.net> wrote:

> ---
>  src/mesa/drivers/dri/i965/brw_reg.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_reg.h
> b/src/mesa/drivers/dri/i965/brw_reg.h
> index 37a2ca9..2591cbf 100644
> --- a/src/mesa/drivers/dri/i965/brw_reg.h
> +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> @@ -154,6 +154,27 @@ type_sz(unsigned type)
>     }
>  }
>
> +static inline bool
> +type_is_signed(unsigned type)
> +{
> +   switch(type) {
> +   case BRW_REGISTER_TYPE_D:
> +   case BRW_REGISTER_TYPE_F:
> +   case BRW_REGISTER_TYPE_HF:
> +   case BRW_REGISTER_TYPE_W:
> +   case BRW_REGISTER_TYPE_B:
> +      return true;
> +
> +   case BRW_REGISTER_TYPE_UD:
> +   case BRW_REGISTER_TYPE_UW:
> +   case BRW_REGISTER_TYPE_UB:
> +      return false;
> +
> +   default:
> +      unreachable();
> +   }
> +}
> +
>

If the call to unreachable() is replaced with an assertion (as we've
discussed elsewhere on the list), this patch is:

Reviewed-by: Paul Berry <stereotype441 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131230/30cab811/attachment.html>


More information about the mesa-dev mailing list