MCPcopy Create free account
hub / github.com/VCVRack/Rack / bitCast

Function bitCast

include/common.hpp:156–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154/** Casts a primitive, preserving its bits instead of converting. */
155template <typename To, typename From>
156To 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected