microsoft/compiler: Use memcpy instead of a union to write dxil_features
While compiling spirv_to_dxil with clang, during writing struct dxil_features
out only results in the low bits being written correctly. This is because struct dxil_features
is only 4 bytes, while it gets unioned with a uint64_t
(8 bytes). The extra bytes are either uninitialized or initialized with a pattern (0xAA
), depending on -ftrivial-auto-var-init
's setting.
This change uses a memcpy
to pack struct dxil_features
into a uint64_t
, rather than a union. This shouldn't have the same uninitialized bits issue.
Edited by Michael Tang