Fix typo in swizzle processing loop
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 24 Mar 2010 22:27:50 +0000 (15:27 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 24 Mar 2010 22:27:50 +0000 (15:27 -0700)
One of the accesses to str in the loop used str[0] instead of str[i].

Reported-by: Kenneth Graunke
hir_field_selection.cpp

index 9928b7b0bfada7d465d01caaa1632c06ff95fe76..aa53120dbdb49326c9543620ef3a26c15a036dc4 100644 (file)
@@ -93,7 +93,7 @@ generate_swizzle(const char *str, ir_dereference *deref,
       if ((str[i] < 'a') || (str[i] > 'z'))
         return false;
 
-      swiz_idx[i] = idx_map[str[0] - 'a'] - base;
+      swiz_idx[i] = idx_map[str[i] - 'a'] - base;
       if ((swiz_idx[i] < 0) || (swiz_idx[i] >= (int) vector_length))
         return false;
    }