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

Francisco Jerez currojerez at riseup.net
Mon Dec 2 11:36:15 PST 2013


---
 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();
+   }
+}
+
 /**
  * Construct a brw_reg.
  * \param file      one of the BRW_x_REGISTER_FILE values
-- 
1.8.3.4



More information about the mesa-dev mailing list