nir: get_base_type() should return enum type
authorRob Clark <robdclark@chromium.org>
Wed, 3 Jun 2020 19:07:52 +0000 (12:07 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 3 Jun 2020 21:24:12 +0000 (21:24 +0000)
Needed by the next patch, for c++ code which is more strict about
conversions between integers and enums.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>

src/compiler/nir/nir.h

index b7f7e46c9b09072106e685e6e3d58a805d52745c..a673a2a8f31260d251b41879e76744276ef2bcd6 100644 (file)
@@ -1023,10 +1023,10 @@ nir_alu_type_get_type_size(nir_alu_type type)
    return type & NIR_ALU_TYPE_SIZE_MASK;
 }
 
-static inline unsigned
+static inline nir_alu_type
 nir_alu_type_get_base_type(nir_alu_type type)
 {
-   return type & NIR_ALU_TYPE_BASE_TYPE_MASK;
+   return (nir_alu_type)(type & NIR_ALU_TYPE_BASE_TYPE_MASK);
 }
 
 static inline nir_alu_type