| 154 | /** Casts a primitive, preserving its bits instead of converting. */ |
| 155 | template <typename To, typename From> |
| 156 | To bitCast(From from) { |
| 157 | static_assert(sizeof(From) == sizeof(To), "Types must be the same size"); |
| 158 | To to; |
| 159 | // This is optimized out |
| 160 | std::memcpy(&to, &from, sizeof(From)); |
| 161 | return to; |
| 162 | } |
| 163 | |
| 164 | |
| 165 | /** C#-style property constructor |
nothing calls this directly
no outgoing calls
no test coverage detected