summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2016-05-26 15:53:00 -0700
committerMatt Turner <mattst88@gmail.com>2016-07-26 12:12:27 -0700
commit149309a424ed8c19354fc2c5830f927787f02ccc (patch)
treefebae3cec225306a1292180f1299e69d50fcd2e3 /src/compiler/glsl/ir_constant_expression.cpp
parentd1f6f656973a2e18641441e3c97b30799a82de52 (diff)
downloadexternal_mesa3d-149309a424ed8c19354fc2c5830f927787f02ccc.zip
external_mesa3d-149309a424ed8c19354fc2c5830f927787f02ccc.tar.gz
external_mesa3d-149309a424ed8c19354fc2c5830f927787f02ccc.tar.bz2
glsl: Avoid aliasing violations.
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/compiler/glsl/ir_constant_expression.cpp')
-rw-r--r--src/compiler/glsl/ir_constant_expression.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index ea50087..6329acd 100644
--- a/src/compiler/glsl/ir_constant_expression.cpp
+++ b/src/compiler/glsl/ir_constant_expression.cpp
@@ -1573,18 +1573,13 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
data.f[c] = CLAMP(op[0]->value.f[c], 0.0f, 1.0f);
}
break;
- case ir_unop_pack_double_2x32: {
+ case ir_unop_pack_double_2x32:
/* XXX needs to be checked on big-endian */
- uint64_t temp;
- temp = (uint64_t)op[0]->value.u[0] | ((uint64_t)op[0]->value.u[1] << 32);
- data.d[0] = *(double *)&temp;
-
+ memcpy(&data.d[0], &op[0]->value.u[0], sizeof(double));
break;
- }
case ir_unop_unpack_double_2x32:
/* XXX needs to be checked on big-endian */
- data.u[0] = *(uint32_t *)&op[0]->value.d[0];
- data.u[1] = *((uint32_t *)&op[0]->value.d[0] + 1);
+ memcpy(&data.u[0], &op[0]->value.d[0], sizeof(double));
break;
case ir_triop_bitfield_extract: {