Mesa (master): gallivm: Add type checks for the basic operations.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Aug 8 13:04:02 PDT 2010


Module: Mesa
Branch: master
Commit: d8279728165eec2da6031cf543820acad322d192
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8279728165eec2da6031cf543820acad322d192

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Aug  8 21:02:59 2010 +0100

gallivm: Add type checks for the basic operations.

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index f5f2623..98e8e49 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -190,6 +190,9 @@ lp_build_add(struct lp_build_context *bld,
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
    if(a == bld->zero)
       return b;
    if(b == bld->zero)
@@ -273,6 +276,9 @@ lp_build_sub(struct lp_build_context *bld,
    const struct lp_type type = bld->type;
    LLVMValueRef res;
 
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
    if(b == bld->zero)
       return a;
    if(a == bld->undef || b == bld->undef)
@@ -395,6 +401,9 @@ lp_build_mul(struct lp_build_context *bld,
    LLVMValueRef shift;
    LLVMValueRef res;
 
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
    if(a == bld->zero)
       return bld->zero;
    if(a == bld->one)
@@ -518,6 +527,9 @@ lp_build_div(struct lp_build_context *bld,
 {
    const struct lp_type type = bld->type;
 
+   assert(lp_check_value(type, a));
+   assert(lp_check_value(type, b));
+
    if(a == bld->zero)
       return bld->zero;
    if(a == bld->one)



More information about the mesa-commit mailing list