diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/macros.h | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index a62dbb8b0ad..430efb3021d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -131,7 +131,7 @@ fs_visitor::nir_setup_outputs(nir_shader *shader) switch (stage) { case MESA_SHADER_VERTEX: - for (int i = 0; i < ALIGN(type_size_scalar(var->type), 4) / 4; i++) { + for (unsigned int i = 0; i < ALIGN(type_size_scalar(var->type), 4) / 4; i++) { int output = var->data.location + i; this->outputs[output] = offset(reg, bld, 4 * i); this->output_components[output] = vector_elements; diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 54df50c9cfe..c3ef42a4282 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -690,7 +690,12 @@ minify(unsigned value, unsigned levels) * * \sa ROUND_DOWN_TO() */ -#define ALIGN(value, alignment) (((value) + (alignment) - 1) & ~((alignment) - 1)) +static inline uintptr_t +ALIGN(uintptr_t value, int32_t alignment) +{ + assert((alignment > 0) && _mesa_is_pow_two(alignment)); + return (((value) + (alignment) - 1) & ~((alignment) - 1)); +} /** * Align a value down to an alignment value @@ -703,7 +708,12 @@ minify(unsigned value, unsigned levels) * * \sa ALIGN() */ -#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1)) +static inline uintptr_t +ROUND_DOWN_TO(uintptr_t value, int32_t alignment) +{ + assert((alignment > 0) && _mesa_is_pow_two(alignment)); + return ((value) & ~(alignment - 1)); +} /** Cross product of two 3-element vectors */ |