[Mesa-dev] [PATCH 2/2] nir: fix shift for uint64_t

Timothy Arceri tarceri at itsqueeze.com
Tue Dec 12 03:47:19 UTC 2017


---
 src/compiler/nir/nir_lower_io_arrays_to_elements.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
index dca5719f114..cdf9a76a881 100644
--- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
+++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
@@ -240,21 +240,21 @@ create_indirects_mask(nir_shader *shader, uint64_t *indirects,
                    intr->intrinsic != nir_intrinsic_interp_var_at_centroid &&
                    intr->intrinsic != nir_intrinsic_interp_var_at_sample &&
                    intr->intrinsic != nir_intrinsic_interp_var_at_offset)
                   continue;
 
                nir_variable *var = intr->variables[0]->var;
 
                if (var->data.mode != mode)
                   continue;
 
-               uint64_t loc_mask = 1 << var->data.location;
+               uint64_t loc_mask = ((uint64_t)1) << var->data.location;
                if (var->data.patch) {
                   if (deref_has_indirect(&b, var, intr->variables[0]))
                      patch_indirects[var->data.location_frac] |= loc_mask;
                } else {
                   if (deref_has_indirect(&b, var, intr->variables[0]))
                      indirects[var->data.location_frac] |= loc_mask;
                }
             }
          }
       }
@@ -282,21 +282,21 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
                if (intr->intrinsic != nir_intrinsic_load_var &&
                    intr->intrinsic != nir_intrinsic_store_var &&
                    intr->intrinsic != nir_intrinsic_interp_var_at_centroid &&
                    intr->intrinsic != nir_intrinsic_interp_var_at_sample &&
                    intr->intrinsic != nir_intrinsic_interp_var_at_offset)
                   continue;
 
                nir_variable *var = intr->variables[0]->var;
 
                /* Skip indirects */
-               uint64_t loc_mask = 1 << var->data.location;
+               uint64_t loc_mask = ((uint64_t)1) << var->data.location;
                if (var->data.patch) {
                   if (patch_indirects[var->data.location_frac] & loc_mask)
                      continue;
                } else {
                   if (indirects[var->data.location_frac] & loc_mask)
                      continue;
                }
 
                nir_variable_mode mode = var->data.mode;
 
-- 
2.14.3



More information about the mesa-dev mailing list