llvmpipe: fix broken lp_build_abs()

This commit is contained in:
Brian Paul 2009-12-14 15:24:31 -07:00
parent b06b3a4925
commit 6e2a93739e
1 changed files with 2 additions and 1 deletions

View File

@ -591,7 +591,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, "");