From: Ian Romanick Date: Sat, 2 Aug 2014 01:39:21 +0000 (-0700) Subject: mesa: Use MAX2 to calculate maximum uniform element X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f81f4e18537fcb7cd1cc5e0dec679d20b7d769c;p=mesa.git mesa: Use MAX2 to calculate maximum uniform element Signed-off-by: Ian Romanick Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 7b089fa9595..2dc9f273b47 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -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);