y_scale = samples * 0.5;
/* We expect only power of 2 samples in source multisample buffer. */
- assert(samples > 0 && is_power_of_two(samples));
+ assert(samples > 0 && _mesa_is_pow_two(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
}
/* We expect only power of 2 samples in source multisample buffer. */
- assert(samples > 0 && is_power_of_two(samples));
+ assert(samples > 0 && _mesa_is_pow_two(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
* (so the floating point exponent just gets increased), rather than
* doing a naive sum and dividing.
*/
- assert(is_power_of_two(samples));
+ assert(_mesa_is_pow_two(samples));
/* Fetch each individual sample. */
sample_resolve = rzalloc_size(mem_ctx, 1);
for (i = 0; i < samples; i++) {
* Thus, I guess we need do this for other platforms as well.
*/
if (tObj->Target == GL_TEXTURE_CUBE_MAP_ARB &&
- !is_power_of_two(firstImage->Height))
+ !_mesa_is_pow_two(firstImage->Height))
return false;
state[I915_TEXREG_SS3] = ss3; /* SS3_NORMALIZED_COORDS */
return visit_continue_with_parent;
}
if (ir->lhs->as_dereference_variable() &&
- is_power_of_two(ir->write_mask) &&
+ _mesa_is_pow_two(ir->write_mask) &&
!ir->condition) {
/* If we're writing just a channel, then channel-splitting the LHS is OK.
*/
spread(struct brw_reg reg, unsigned s)
{
if (s) {
- assert(is_power_of_two(s));
+ assert(_mesa_is_pow_two(s));
if (reg.hstride)
reg.hstride += cvt(s) - 1;
int i = 0;
/* Alignment computations below assume bpp >= 8 and a power of 2. */
- assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp));
+ assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp));
switch(mt->target) {
case GL_TEXTURE_1D:
ret_align = mt->tr_mode == INTEL_MIPTREE_TRMODE_YF ?
align_yf[i] : align_ys[i];
- assert(is_power_of_two(mt->num_samples));
+ assert(_mesa_is_pow_two(mt->num_samples));
switch (mt->num_samples) {
case 2:
mt->target != GL_TEXTURE_1D_ARRAY);
/* Alignment computations below assume bpp >= 8 and a power of 2. */
- assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp)) ;
+ assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp)) ;
switch(mt->target) {
case GL_TEXTURE_2D:
ret_align = mt->tr_mode == INTEL_MIPTREE_TRMODE_YF ?
align_yf[i] : align_ys[i];
- assert(is_power_of_two(mt->num_samples));
+ assert(_mesa_is_pow_two(mt->num_samples));
switch (mt->num_samples) {
case 4:
*
* where they pack the four bytes from the low and high four DW.
*/
- assert(is_power_of_two(dst.dw1.bits.writemask) &&
+ assert(_mesa_is_pow_two(dst.dw1.bits.writemask) &&
dst.dw1.bits.writemask != 0);
unsigned offset = __builtin_ctz(dst.dw1.bits.writemask);
return 0;
/* Compute array index. */
- assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp));
+ assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp));
i = ffs(bpp / 8) - 1;
align = tr_mode == INTEL_MIPTREE_TRMODE_YF ?
align_2d_yf[i] :
4 * align_2d_yf[i];
- assert(is_power_of_two(align));
+ assert(_mesa_is_pow_two(align));
/* XY_FAST_COPY_BLT doesn't support horizontal alignment of 16. */
if (align == 16)
return 0;
/* Compute array index. */
- assert (bpp >= 8 && bpp <= 128 && is_power_of_two(bpp));
+ assert (bpp >= 8 && bpp <= 128 && _mesa_is_pow_two(bpp));
i = ffs(bpp / 8) - 1;
align = tr_mode == INTEL_MIPTREE_TRMODE_YF ?
align_2d_yf[i] :
4 * align_2d_yf[i];
- assert(is_power_of_two(align));
+ assert(_mesa_is_pow_two(align));
/* XY_FAST_COPY_BLT doesn't support vertical alignments of 16 and 32. */
if (align == 16 || align == 32)
return MAX2(1, value >> levels);
}
-/**
- * Return true if the given value is a power of two.
- *
- * Note that this considers 0 a power of two.
- */
-static inline bool
-is_power_of_two(unsigned value)
-{
- return (value & (value - 1)) == 0;
-}
-
/**
* Align a value up to an alignment value
*