Mesa (master): meta: Use is_power_of_two() helper function
Anuj Phogat
aphogat at kemper.freedesktop.org
Mon Jun 15 16:20:54 UTC 2015
Module: Mesa
Branch: master
Commit: 6c14b66e40d34104c841ee6dfaeb65617e47be80
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c14b66e40d34104c841ee6dfaeb65617e47be80
Author: Anuj Phogat <anuj.phogat at gmail.com>
Date: Mon Jun 1 09:32:55 2015 -0700
meta: Use is_power_of_two() helper function
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
---
src/mesa/drivers/common/meta_blit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index bb21642..9cace2b 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -82,7 +82,7 @@ setup_glsl_msaa_blit_scaled_shader(struct gl_context *ctx,
y_scale = samples * 0.5;
/* We expect only power of 2 samples in source multisample buffer. */
- assert(samples > 0 && (samples & (samples - 1)) == 0);
+ assert(samples > 0 && is_power_of_two(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
@@ -263,7 +263,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
}
/* We expect only power of 2 samples in source multisample buffer. */
- assert(samples > 0 && (samples & (samples - 1)) == 0);
+ assert(samples > 0 && is_power_of_two(samples));
while (samples >> (shader_offset + 1)) {
shader_offset++;
}
@@ -434,7 +434,7 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
* (so the floating point exponent just gets increased), rather than
* doing a naive sum and dividing.
*/
- assert((samples & (samples - 1)) == 0);
+ assert(is_power_of_two(samples));
/* Fetch each individual sample. */
sample_resolve = rzalloc_size(mem_ctx, 1);
for (i = 0; i < samples; i++) {
More information about the mesa-commit
mailing list