diff options
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_arit.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_gather.c | 8 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_pack.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_sample.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_ringbuffer.c | 2 |
8 files changed, 14 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 321c6e4edf0..e922474ef61 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1307,7 +1307,7 @@ lp_build_mul_imm(struct lp_build_context *bld, if(b == 2 && bld->type.floating) return lp_build_add(bld, a, a); - if(util_is_power_of_two(b)) { + if(util_is_power_of_two_or_zero(b)) { unsigned shift = ffs(b) - 1; if(bld->type.floating) { diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index f311fe7f690..23ada3d0433 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -60,7 +60,7 @@ extern "C" boolean lp_check_alignment(const void *ptr, unsigned alignment) { - assert(util_is_power_of_two(alignment)); + assert(util_is_power_of_two_or_zero(alignment)); return ((uintptr_t)ptr & (alignment - 1)) == 0; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c index 36dedba34f0..b52acca1b3e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c @@ -496,7 +496,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, if (format_matches_type(format_desc, type) && format_desc->block.bits <= type.width * 4 && /* XXX this shouldn't be needed */ - util_is_power_of_two(format_desc->block.bits)) { + util_is_power_of_two_or_zero(format_desc->block.bits)) { LLVMValueRef packed; LLVMTypeRef dst_vec_type = lp_build_vec_type(gallivm, type); struct lp_type fetch_type; @@ -609,7 +609,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm, format_desc->block.width == 1 && format_desc->block.height == 1 && /* XXX this shouldn't be needed */ - util_is_power_of_two(format_desc->block.bits) && + util_is_power_of_two_or_zero(format_desc->block.bits) && format_desc->block.bits <= 32 && format_desc->is_bitmask && !format_desc->is_mixed && diff --git a/src/gallium/auxiliary/gallivm/lp_bld_gather.c b/src/gallium/auxiliary/gallivm/lp_bld_gather.c index 7d11dcd3b64..8cabe9ef01e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_gather.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_gather.c @@ -118,7 +118,7 @@ lp_build_gather_elem(struct gallivm_state *gallivm, */ if (!aligned) { LLVMSetAlignment(res, 1); - } else if (!util_is_power_of_two(src_width)) { + } else if (!util_is_power_of_two_or_zero(src_width)) { /* * Full alignment is impossible, assume the caller really meant * the individual elements were aligned (e.g. 3x32bit format). @@ -130,7 +130,7 @@ lp_build_gather_elem(struct gallivm_state *gallivm, * this should cover all the 3-channel formats. */ if (((src_width / 24) * 24 == src_width) && - util_is_power_of_two(src_width / 24)) { + util_is_power_of_two_or_zero(src_width / 24)) { LLVMSetAlignment(res, src_width / 24); } else { LLVMSetAlignment(res, 1); @@ -199,7 +199,7 @@ lp_build_gather_elem_vec(struct gallivm_state *gallivm, */ if (!aligned) { LLVMSetAlignment(res, 1); - } else if (!util_is_power_of_two(src_width)) { + } else if (!util_is_power_of_two_or_zero(src_width)) { /* * Full alignment is impossible, assume the caller really meant * the individual elements were aligned (e.g. 3x32bit format). @@ -211,7 +211,7 @@ lp_build_gather_elem_vec(struct gallivm_state *gallivm, * this should cover all the 3-channel formats. */ if (((src_width / 24) * 24 == src_width) && - util_is_power_of_two(src_width / 24)) { + util_is_power_of_two_or_zero(src_width / 24)) { LLVMSetAlignment(res, src_width / 24); } else { LLVMSetAlignment(res, 1); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c index 7879826422d..b8b53a7d6eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c @@ -219,7 +219,7 @@ lp_build_concat(struct gallivm_state *gallivm, LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH]; assert(src_type.length * num_vectors <= ARRAY_SIZE(shuffles)); - assert(util_is_power_of_two(num_vectors)); + assert(util_is_power_of_two_or_zero(num_vectors)); new_length = src_type.length; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index ab9d051c911..81cb5060711 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -114,9 +114,9 @@ lp_sampler_static_texture_state(struct lp_static_texture_state *state, state->swizzle_a = view->swizzle_a; state->target = view->target; - state->pot_width = util_is_power_of_two(texture->width0); - state->pot_height = util_is_power_of_two(texture->height0); - state->pot_depth = util_is_power_of_two(texture->depth0); + state->pot_width = util_is_power_of_two_or_zero(texture->width0); + state->pot_height = util_is_power_of_two_or_zero(texture->height0); + state->pot_depth = util_is_power_of_two_or_zero(texture->depth0); state->level_zero_only = !view->u.tex.last_level; /* diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index a441b5457b2..46d02978fd6 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -179,14 +179,6 @@ util_fast_pow(float x, float y) return util_fast_exp2(util_fast_log2(x) * y); } -/* Note that this counts zero as a power of two. - */ -static inline boolean -util_is_power_of_two( unsigned v ) -{ - return (v & (v-1)) == 0; -} - /** * Floor(x), returned as int. @@ -459,7 +451,7 @@ util_next_power_of_two(unsigned x) if (x <= 1) return 1; - if (util_is_power_of_two(x)) + if (util_is_power_of_two_or_zero(x)) return x; val--; diff --git a/src/gallium/auxiliary/util/u_ringbuffer.c b/src/gallium/auxiliary/util/u_ringbuffer.c index 4d6166833e4..f6bb910671e 100644 --- a/src/gallium/auxiliary/util/u_ringbuffer.c +++ b/src/gallium/auxiliary/util/u_ringbuffer.c @@ -27,7 +27,7 @@ struct util_ringbuffer *util_ringbuffer_create( unsigned dwords ) if (!ring) return NULL; - assert(util_is_power_of_two(dwords)); + assert(util_is_power_of_two_or_zero(dwords)); ring->buf = MALLOC( dwords * sizeof(unsigned) ); if (ring->buf == NULL) |