util: use uint32_t as the parameter of align function
authorYonggang Luo <luoyonggang@gmail.com>
Sun, 4 Jun 2023 06:42:51 +0000 (14:42 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 06:41:21 +0000 (06:41 +0000)
align on negative value doesn't make sense

Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23421>

src/amd/compiler/aco_instruction_selection.cpp
src/util/u_math.h

index e7c7bb5..9f7a170 100644 (file)
@@ -4010,7 +4010,7 @@ can_use_byte_align_for_global_load(unsigned num_components, unsigned component_s
    if (align_ < 4) {
       assert(component_size < 4);
       unsigned load_size = num_components * component_size;
-      int new_size = align(load_size + (4 - align_), 4);
+      uint32_t new_size = align(load_size + (4 - align_), 4);
       return new_size == align(load_size, 4) && (new_size != 12 || support_12_byte);
    }
    return true;
index 149d223..61c69a2 100644 (file)
@@ -691,8 +691,8 @@ ROUND_DOWN_TO(uint64_t value, uint32_t alignment)
 /**
  * Align a value, only works pot alignemnts.
  */
-static inline int
-align(int value, int alignment)
+static inline uint32_t
+align(uint32_t value, uint32_t alignment)
 {
    assert(IS_POT(alignment));
    return ALIGN_POT(value, alignment);