Please sign in to comment.
BitUtils: Add C++14/C++17 compatible equivalent of std::bit_cast from…
… C++2a Given bit conversions between types are quite common in emulation (particularly when it comes to floating-point among other things) it makes sense to provide a utility function that keeps all the boilerplate contained; especially considering it makes it harder to accidentally misuse std::memcpy (such as accidentally transposing arguments, etc). Another benefit of this function is that it doesn't require separating declarations from assignments, allowing variables to be declared const. This makes the scenario of of uninitialized variables being used less likely to occur.
- Loading branch information...
Showing with 47 additions and 0 deletions.