summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-09-02 11:32:09 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-09-05 10:17:51 +0100
commit6ed726b8fc6210a41fe325591e1428d19f419108 (patch)
treea8f6a8d64f8a43d4d4095783e16e57e62512ed99 /src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
parent079763f74648fef051ee5b8f7d730f7fc1ba27d5 (diff)
gallivm: Pass condition masks as an unsigned bitmask.
Much more convenient than boolean arrays.
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_swizzle.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 20cf96ca66..fced983396 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -139,13 +139,10 @@ lp_build_broadcast_aos(struct lp_build_context *bld,
{ 1, -2},
{-1, -2}
};
- boolean cond[4];
unsigned i;
- memset(cond, 0, sizeof cond);
- cond[channel] = 1;
-
- a = LLVMBuildAnd(bld->builder, a, lp_build_const_mask_aos(type, cond), "");
+ a = LLVMBuildAnd(bld->builder, a,
+ lp_build_const_mask_aos(type, 1 << channel), "");
/*
* Build a type where each element is an integer that cover the four
@@ -282,7 +279,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
*/
LLVMValueRef res;
struct lp_type type4;
- boolean cond[4];
+ unsigned cond = 0;
unsigned chan;
int shift;
@@ -290,9 +287,11 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
* Start with a mixture of 1 and 0.
*/
for (chan = 0; chan < 4; ++chan) {
- cond[chan] = swizzles[chan] == PIPE_SWIZZLE_ONE ? TRUE : FALSE;
+ if (swizzles[chan] == PIPE_SWIZZLE_ONE) {
+ cond |= 1 << chan;
+ }
}
- res = lp_build_select_aos(bld, bld->one, bld->zero, cond);
+ res = lp_build_select_aos(bld, cond, bld->one, bld->zero);
/*
* Build a type where each element is an integer that cover the four