mesa: Use MAX2 to calculate maximum uniform element
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 2 Aug 2014 01:39:21 +0000 (18:39 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 7 Aug 2014 23:17:48 +0000 (16:17 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/uniform_query.cpp

index 7b089fa9595959c254d2885a24d3556cbd9328a9..2dc9f273b47d90dcb265223a01263397b4027ce6 100644 (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);