mesa: Use MAX2 to calculate maximum uniform element

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick 2014-08-01 18:39:21 -07:00
parent 411abcb237
commit 8f81f4e185

View file

@ -282,9 +282,7 @@ validate_uniform_parameters(struct gl_context *ctx,
* If not an array, check that array_index is zero.
* array_index is unsigned so no need to check for less than zero.
*/
unsigned limit = uni->array_elements;
if (limit == 0)
limit = 1;
const unsigned limit = MAX2(uni->array_elements, 1);
if (*array_index >= limit) {
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)",
caller, location);