mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
d/psmv: Fix strict aliasing warnings when compiling with optimisations
This commit is contained in:
parent
aaaa9fc235
commit
3f13224502
|
@ -372,9 +372,14 @@ psmv_vec3_i32_from_i16_wire(struct psmv_vec3_i32 *to,
|
|||
static void
|
||||
psmv_f32_from_wire(float *to, const struct psmv_f32_wire *from)
|
||||
{
|
||||
uint32_t v = (from->val[0] << 0) | (from->val[1] << 8) |
|
||||
(from->val[2] << 16) | (from->val[3] << 24);
|
||||
*to = *((float *)&v);
|
||||
union {
|
||||
uint32_t wire;
|
||||
float f32;
|
||||
} safe_copy;
|
||||
|
||||
safe_copy.wire = (from->val[0] << 0) | (from->val[1] << 8) |
|
||||
(from->val[2] << 16) | (from->val[3] << 24);
|
||||
*to = safe_copy.f32;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue