Fix MSVC build: std::memcpy instead of __builtin_memcpy

The 'build' and 'check' jobs failed with C3861 on MSVC 14.52:
__builtin_memcpy is GCC/Clang-only. std::memcpy (<cstring>) works
everywhere the portable model compiles.
This commit is contained in:
SuarezPM
2026-11-21 17:15:29 -03:00
parent 612f1edebd
commit d2debe87af

View File

@ -1,6 +1,8 @@
// Portable root-signature packer, see root_signature.h.
#include "root_signature.h"
#include <cstring>
namespace rt::rootsig {
PackResult pack(const RootSignature& sig) {
@ -54,7 +56,7 @@ void put_u32(std::vector<uint8_t>& out, uint32_t v) {
void put_f32(std::vector<uint8_t>& out, float v) {
uint32_t bits = 0;
static_assert(sizeof(bits) == sizeof(v));
__builtin_memcpy(&bits, &v, sizeof(bits));
std::memcpy(&bits, &v, sizeof(bits));
put_u32(out, bits);
}
@ -75,7 +77,7 @@ public:
[[nodiscard]] bool f32(float& v) {
uint32_t bits = 0;
if (!u32(bits)) return false;
__builtin_memcpy(&v, &bits, sizeof(v));
std::memcpy(&v, &bits, sizeof(v));
return true;
}