Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/spirv.c:
type_id, vector1_id, vector2_id, components, component_count);
}
+/* Based on the implementation in the OpenGL Mathematics library. */ +static uint32_t half_to_float(uint16_t value) +{
- uint32_t s = (value & 0x8000) << 16;
My understanding is that's undefined behaviour if `value` represents a negative number: `value` has type `uint16_t`, the constant `0x8000` has type `int`, so the type of `value & 0x8000` is `int` (because the entire range of `uint16_t` fits an `int`). And left shifting a bit to the sign bit is undefined behaviour. This can be fixed by using `0x8000u`.