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

Carl Worth cworth at kemper.freedesktop.org
Wed Oct 16 22:10:51 UTC 2013


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

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>
(cherry picked from commit bfe6e5dda5fcf65a3941ed4cca5eea755421979a)

---

 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 ddfeee2..f6466e8 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -672,7 +672,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