From 6ed726b8fc6210a41fe325591e1428d19f419108 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 2 Sep 2010 11:32:09 +0100 Subject: gallivm: Pass condition masks as an unsigned bitmask. Much more convenient than boolean arrays. --- src/gallium/auxiliary/gallivm/lp_bld_swizzle.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/gallium/auxiliary/gallivm/lp_bld_swizzle.c') 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 -- cgit v1.2.3