Mesa (master): mesa: Fix compiler warnings when ALIGN's alignment is "1 << value".

Eric Anholt anholt at kemper.freedesktop.org
Wed Oct 9 18:41:54 UTC 2013


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct  8 00:23:29 2013 -0700

mesa: Fix compiler warnings when ALIGN's alignment is "1 << value".

We hadn't run into order of operation warnings before, apparently, since
addition is so low on the order.

Cc: "9.1 9.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/macros.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 1052f75..05aad4e 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -673,7 +673,7 @@ minify(unsigned value, unsigned levels)
  *
  * \sa ROUND_DOWN_TO()
  */
-#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
+#define ALIGN(value, alignment)  (((value) + (alignment) - 1) & ~((alignment) - 1))
 
 
 




More information about the mesa-commit mailing list