Implement std::bit_cast<>

Partial implementation of std::bit_cast from C++20.
Also fix most strict-aliasing rule break warnings (gcc).
This commit is contained in:
Nekotekina 2019-06-02 00:12:17 +03:00
parent 790962425c
commit dfd50d0185
24 changed files with 145 additions and 176 deletions

View file

@ -440,7 +440,7 @@ namespace
{
be_t<u32> stored_val = as_const_span<const be_t<u32>>(orig_buffer)[idx];
u32 swapped_val = stored_val;
f32 float_val = (f32&)swapped_val;
f32 float_val = std::bit_cast<f32>(swapped_val);
u8 val = float_val * 255.f;
return{ val, val, val };
}