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;
*
* \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
*
* \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 */