mesa: Fix compiler warnings when ALIGN's alignment is "1 << value".
authorEric Anholt <eric@anholt.net>
Tue, 8 Oct 2013 07:23:29 +0000 (00:23 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 9 Oct 2013 18:28:19 +0000 (11:28 -0700)
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@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/main/macros.h

index 1052f756074b10bc7274e5c3fa115d7e2b530efb..05aad4eb8b1e939c39fb5c331abd54c973ae8191 100644 (file)
@@ -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))