1
0

Fix warning strict alignment break

This commit is contained in:
Hans-Joerg Schurr 2020-04-24 23:00:08 +02:00
parent afa96fdf12
commit 6b14f544e7

View File

@ -97,7 +97,7 @@ typedef enum hvif_line_cap
HVIF_LINE_CAP_TYPE_MAX
} hvif_line_cap;
/* An affine transformation. Ugly until I understand better how they are used */
/* An affine transformation. */
typedef struct hvif_matrix hvif_matrix;
struct hvif_matrix
{
@ -242,8 +242,13 @@ hvif_decode_float(uint8_t buffer[static 1])
return 0.0;
else {
/* TODO: float might not be IEEE 754 compatible */
uint32_t value = (sign << 31) | ((exponent + 127) << 23) | mantissa;
return *((float*)&value);
union
{
uint32_t uint_f;
float float_f;
} value;
value.uint_f = (sign << 31) | ((exponent + 127) << 23) | mantissa;
return value.float_f;
}
}
static inline hvif_matrix