util: remove util_is_pot in favor of util_is_power_of_two
authorMarek Olšák <maraeo@gmail.com>
Sun, 29 Aug 2010 04:03:39 +0000 (06:03 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sun, 29 Aug 2010 04:16:25 +0000 (06:16 +0200)
The function was duplicated.

src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/auxiliary/gallivm/lp_bld_debug.c
src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/util/u_math.h
src/gallium/drivers/galahad/glhd_screen.c

index bb30e6e9dfbe665d311a6d5aee072afcb1d479f9..7bb57061f5bf6d0dbc295a79c299af08bc1759ec 100644 (file)
@@ -538,7 +538,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_pot(b)) {
+   if(util_is_power_of_two(b)) {
       unsigned shift = ffs(b) - 1;
 
       if(bld->type.floating) {
index 39dfc51e50331b6cabeaa2f076a2fc069f610b9f..d3a5afff8c23029bd7c45a4e63632d5252e37e30 100644 (file)
@@ -46,7 +46,7 @@
 boolean
 lp_check_alignment(const void *ptr, unsigned alignment)
 {
-   assert(util_is_pot(alignment));
+   assert(util_is_power_of_two(alignment));
    return ((uintptr_t)ptr & (alignment - 1)) == 0;
 }
 
index 247cb83ce6c4dcce96a29732d1b0dca30e063ca9..92123e09d3289c5d00a706749928c00d7fc24994 100644 (file)
@@ -388,7 +388,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
 
    if (format_matches_type(format_desc, type) &&
        format_desc->block.bits <= type.width * 4 &&
-       util_is_pot(format_desc->block.bits)) {
+       util_is_power_of_two(format_desc->block.bits)) {
       LLVMValueRef packed;
 
       /*
@@ -416,7 +416,7 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
         format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) &&
        format_desc->block.width == 1 &&
        format_desc->block.height == 1 &&
-       util_is_pot(format_desc->block.bits) &&
+       util_is_power_of_two(format_desc->block.bits) &&
        format_desc->block.bits <= 32 &&
        format_desc->is_bitmask &&
        !format_desc->is_mixed &&
index 0fd014ab9b3632d6db2b061c35e6da52da59a9bd..3c4992b25e61a70fdd5594d174614bb3e57418a9 100644 (file)
@@ -82,9 +82,9 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
    state->swizzle_a         = view->swizzle_a;
 
    state->target            = texture->target;
-   state->pot_width         = util_is_pot(texture->width0);
-   state->pot_height        = util_is_pot(texture->height0);
-   state->pot_depth         = util_is_pot(texture->depth0);
+   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->wrap_s            = sampler->wrap_s;
    state->wrap_t            = sampler->wrap_t;
index af510dac510be71bcba562007ca100e345dd2819..69a76814945d206eadf396a36384b6a7ab5bd76f 100644 (file)
@@ -360,16 +360,6 @@ util_is_inf_or_nan(float x)
 }
 
 
-/**
- * Test whether x is a power of two.
- */
-static INLINE boolean
-util_is_pot(unsigned x)
-{
-   return (x & (x - 1)) == 0;
-}
-
-
 /**
  * Find first bit set in word.  Least significant bit is 1.
  * Return 0 if no bits set.
index a4eac11ae3451f5e8b85f73dac4cadaf2767b4f1..75e4c2d82e91ddd7eae42ca9ffdbf73b28ee87af 100644 (file)
@@ -140,7 +140,7 @@ galahad_screen_resource_create(struct pipe_screen *_screen,
 
    if(templat->target != PIPE_TEXTURE_RECT && templat->target != PIPE_BUFFER && !screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES))
    {
-      if(!util_is_pot(templat->width0) || !util_is_pot(templat->height0))
+      if(!util_is_power_of_two(templat->width0) || !util_is_power_of_two(templat->height0))
          glhd_warn("Requested NPOT (%ux%u) non-rectangle texture without NPOT support", templat->width0, templat->height0);
    }