aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-02-08 01:23:00 +0000
committerDave Airlie <[email protected]>2017-02-08 02:13:07 +0000
commitc674f11e42e25924084aaf825c7dba95748c66fe (patch)
tree5133fb26dff2906019310f6ec86ba7aaddad02b0
parent30cff4f5f740f2d774ec663d5f6ae319f48737b8 (diff)
mesa/st: fix strict aliasing issue in int64 code.
This fixes the int64 code same as the double code. Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 77a51d57a39..116f30c9446 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3363,15 +3363,13 @@ glsl_to_tgsi_visitor::visit(ir_constant *ir)
case GLSL_TYPE_INT64:
gl_type = GL_INT64_ARB;
for (i = 0; i < ir->type->vector_elements; i++) {
- values[i * 2].i = *(uint32_t *)&ir->value.d[i];
- values[i * 2 + 1].i = *(((uint32_t *)&ir->value.d[i]) + 1);
+ memcpy(&values[i * 2], &ir->value.d[i], sizeof(int64_t));
}
break;
case GLSL_TYPE_UINT64:
gl_type = GL_UNSIGNED_INT64_ARB;
for (i = 0; i < ir->type->vector_elements; i++) {
- values[i * 2].i = *(uint32_t *)&ir->value.d[i];
- values[i * 2 + 1].i = *(((uint32_t *)&ir->value.d[i]) + 1);
+ memcpy(&values[i * 2], &ir->value.d[i], sizeof(uint64_t));
}
break;
case GLSL_TYPE_UINT: