diff options
| author | SuarezPM <SuarezPM@users.noreply.github.com> | 2026-11-21 17:15:29 -0300 |
|---|---|---|
| committer | SuarezPM <SuarezPM@users.noreply.github.com> | 2026-11-21 17:15:29 -0300 |
| commit | d2debe87af9fab6c1039ecdbc6dbb5bbb4022653 (patch) | |
| tree | 126c830541ffb910ee20d73519b5eaaf292750fe /runtime/src/root_signature.cpp | |
| parent | 612f1edebdcf5add10d90c259a1a457c86313a93 (diff) | |
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.
Diffstat (limited to 'runtime/src/root_signature.cpp')
| -rw-r--r-- | runtime/src/root_signature.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/src/root_signature.cpp b/runtime/src/root_signature.cpp index eda380198..4892ecb8c 100644 --- a/runtime/src/root_signature.cpp +++ b/runtime/src/root_signature.cpp | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | // Portable root-signature packer, see root_signature.h. | 1 | // Portable root-signature packer, see root_signature.h. |
| 2 | #include "root_signature.h" | 2 | #include "root_signature.h" |
| 3 | 3 | ||
| 4 | #include <cstring> | ||
| 5 | |||
| 4 | namespace rt::rootsig { | 6 | namespace rt::rootsig { |
| 5 | 7 | ||
| 6 | PackResult pack(const RootSignature& sig) { | 8 | PackResult pack(const RootSignature& sig) { |
| @@ -54,7 +56,7 @@ void put_u32(std::vector<uint8_t>& out, uint32_t v) { | |||
| 54 | void put_f32(std::vector<uint8_t>& out, float v) { | 56 | void put_f32(std::vector<uint8_t>& out, float v) { |
| 55 | uint32_t bits = 0; | 57 | uint32_t bits = 0; |
| 56 | static_assert(sizeof(bits) == sizeof(v)); | 58 | static_assert(sizeof(bits) == sizeof(v)); |
| 57 | __builtin_memcpy(&bits, &v, sizeof(bits)); | 59 | std::memcpy(&bits, &v, sizeof(bits)); |
| 58 | put_u32(out, bits); | 60 | put_u32(out, bits); |
| 59 | } | 61 | } |
| 60 | 62 | ||
| @@ -75,7 +77,7 @@ public: | |||
| 75 | [[nodiscard]] bool f32(float& v) { | 77 | [[nodiscard]] bool f32(float& v) { |
| 76 | uint32_t bits = 0; | 78 | uint32_t bits = 0; |
| 77 | if (!u32(bits)) return false; | 79 | if (!u32(bits)) return false; |
| 78 | __builtin_memcpy(&v, &bits, sizeof(v)); | 80 | std::memcpy(&v, &bits, sizeof(v)); |
| 79 | return true; | 81 | return true; |
| 80 | } | 82 | } |
| 81 | 83 | ||