Mesa (master): llvmpipe: Utility function to double the bit width of a type .
Jose Fonseca
jrfonseca at kemper.freedesktop.org
Thu Oct 22 18:12:29 UTC 2009
Module: Mesa
Branch: master
Commit: 4458695bdafb13eba639d986e2f20953f0f7445c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4458695bdafb13eba639d986e2f20953f0f7445c
Author: José Fonseca <jfonseca at vmware.com>
Date: Thu Oct 22 18:28:37 2009 +0100
llvmpipe: Utility function to double the bit width of a type.
---
src/gallium/drivers/llvmpipe/lp_bld_type.c | 29 +++++++++++++++++++++++----
src/gallium/drivers/llvmpipe/lp_bld_type.h | 4 +++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.c b/src/gallium/drivers/llvmpipe/lp_bld_type.c
index 606243d..1320a26 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_type.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_type.c
@@ -160,12 +160,31 @@ lp_build_int_vec_type(struct lp_type type)
struct lp_type
lp_int_type(struct lp_type type)
{
- struct lp_type int_type;
+ struct lp_type res_type;
- memset(&int_type, 0, sizeof int_type);
- int_type.width = type.width;
- int_type.length = type.length;
- return int_type;
+ memset(&res_type, 0, sizeof res_type);
+ res_type.width = type.width;
+ res_type.length = type.length;
+
+ return res_type;
+}
+
+
+/**
+ * Return the type with twice the bit width (hence half the number of elements).
+ */
+struct lp_type
+lp_wider_type(struct lp_type type)
+{
+ struct lp_type res_type;
+
+ memcpy(&res_type, &type, sizeof res_type);
+ res_type.width *= 2;
+ res_type.length /= 2;
+
+ assert(res_type.length);
+
+ return res_type;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.h b/src/gallium/drivers/llvmpipe/lp_bld_type.h
index ee5ca34..46c298f 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_type.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_type.h
@@ -166,6 +166,10 @@ struct lp_type
lp_int_type(struct lp_type type);
+struct lp_type
+lp_wider_type(struct lp_type type);
+
+
void
lp_build_context_init(struct lp_build_context *bld,
LLVMBuilderRef builder,
More information about the mesa-commit
mailing list