mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-12-15 06:12:26 +00:00
shader_ir: Address feedback to avoid UB in bit casting
This commit is contained in:
parent
946c86f0bb
commit
d4fae3a699
1 changed files with 4 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -606,8 +607,9 @@ private:
|
|||
}
|
||||
/// Creates a f32 immediate
|
||||
Node Immediate(f32 value) {
|
||||
// TODO(Rodrigo): Replace this with bit_cast when C++20 releases
|
||||
return Immediate(*reinterpret_cast<const u32*>(&value));
|
||||
u32 integral;
|
||||
std::memcpy(&integral, &value, sizeof(u32));
|
||||
return Immediate(integral);
|
||||
}
|
||||
|
||||
/// Generates a node for a passed register.
|
||||
|
|
Loading…
Reference in a new issue