Mesa (master): mesa: Use MAX2 to calculate maximum uniform element

Ian Romanick idr at kemper.freedesktop.org
Thu Aug 7 23:18:24 UTC 2014


Module: Mesa
Branch: master
Commit: 8f81f4e18537fcb7cd1cc5e0dec679d20b7d769c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f81f4e18537fcb7cd1cc5e0dec679d20b7d769c

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Aug  1 18:39:21 2014 -0700

mesa: Use MAX2 to calculate maximum uniform element

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/uniform_query.cpp |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 7b089fa..2dc9f27 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);




More information about the mesa-commit mailing list