Mesa (mesa_7_7_branch): llvmpipe: fix broken lp_build_abs()

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Jan 28 20:23:03 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 96ec4eb755d0296c807ca5c89383a3b9f9fc1dbe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96ec4eb755d0296c807ca5c89383a3b9f9fc1dbe

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Dec 14 15:24:31 2009 -0700

llvmpipe: fix broken lp_build_abs()

---

 src/gallium/drivers/llvmpipe/lp_bld_arit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
index a94b30a..1aee9b3 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c
@@ -628,7 +628,8 @@ lp_build_abs(struct lp_build_context *bld,
    if(type.floating) {
       /* Mask out the sign bit */
       LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
-      LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long)1 << type.width) - 1);
+      unsigned long absMask = ~(1 << (type.width - 1));
+      LLVMValueRef mask = lp_build_int_const_scalar(type, ((unsigned long long) absMask));
       a = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
       a = LLVMBuildAnd(bld->builder, a, mask, "");
       a = LLVMBuildBitCast(bld->builder, a, vec_type, "");




More information about the mesa-commit mailing list