<p dir="ltr">Can the hash value not be 0?</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 18, 2016 4:57 AM, "Tapani Pälli" <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Implementation previously used case value itself as the key, however<br>
afterhash implementation change by ee02a5e we cannot use 0 as key.<br>
Patch uses _mesa_hash_data to formulate a suitable key for this hash.<br>
<br>
Signed-off-by: Tapani Pälli <<a href="mailto:tapani.palli@intel.com">tapani.palli@intel.com</a>><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=97309" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=97309</a><br>
---<br>
 src/compiler/glsl/ast_to_hir.<wbr>cpp | 6 ++++--<br>
 1 file changed, 4 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/glsl/ast_to_<wbr>hir.cpp b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
index e03a6e3..53fc4d6 100644<br>
--- a/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
+++ b/src/compiler/glsl/ast_to_<wbr>hir.cpp<br>
@@ -6180,9 +6180,11 @@ ast_case_label::hir(exec_list *instructions,<br>
          /* Stuff a dummy value in to allow processing to continue. */<br>
          label_const = new(ctx) ir_constant(0);<br>
       } else {<br>
+         unsigned hash_key = _mesa_hash_data(&label_const-><wbr>value.u[0],<br>
+                                             sizeof(unsigned));<br>
          ast_expression *previous_label = (ast_expression *)<br>
          hash_table_find(state->switch_<wbr>state.labels_ht,<br>
-                         (void *)(uintptr_t)label_const-><wbr>value.u[0]);<br>
+                         (void *)(uintptr_t)hash_key);<br>
<br>
          if (previous_label) {<br>
             YYLTYPE loc = this->test_value->get_<wbr>location();<br>
@@ -6193,7 +6195,7 @@ ast_case_label::hir(exec_list *instructions,<br>
          } else {<br>
             hash_table_insert(state-><wbr>switch_state.labels_ht,<br>
                               this->test_value,<br>
-                              (void *)(uintptr_t)label_const-><wbr>value.u[0]);<br>
+                              (void *)(uintptr_t)hash_key);<br>
          }<br>
       }<br>
<br>
--<br>
2.5.5<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>