Mesa (main): format_utils: properly parenthesize macro params

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 4 13:52:28 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Jun  3 16:32:39 2022 -0400

format_utils: properly parenthesize macro params

this otherwise breaks evaluation of the parameters on arm64

cc: mesa-stable

fixes #6496

Reviewed-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16860>

---

 src/util/format/format_utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/format/format_utils.h b/src/util/format/format_utils.h
index 0768a26ecce..c53d5e0f80f 100644
--- a/src/util/format/format_utils.h
+++ b/src/util/format/format_utils.h
@@ -37,7 +37,7 @@
 /* Extends an integer of size SRC_BITS to one of size DST_BITS linearly */
 #define EXTEND_NORMALIZED_INT(X, SRC_BITS, DST_BITS) \
       (((X) * (int)(u_uintN_max(DST_BITS) / u_uintN_max(SRC_BITS))) + \
-       ((DST_BITS % SRC_BITS) ? ((X) >> (SRC_BITS - DST_BITS % SRC_BITS)) : 0))
+       (((DST_BITS) % (SRC_BITS)) ? ((X) >> ((SRC_BITS) - (DST_BITS) % (SRC_BITS))) : 0))
 
 static inline float
 _mesa_unorm_to_float(unsigned x, unsigned src_bits)



More information about the mesa-commit mailing list