MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / swapEndian

Function swapEndian

extern/happly/happly.h:232–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 */
231template <typename T>
232T swapEndian(T val) {
233 char* bytes = reinterpret_cast<char*>(&val);
234 for (unsigned int i = 0; i < sizeof(val) / 2; i++) {
235 std::swap(bytes[sizeof(val) - 1 - i], bytes[i]);
236 }
237 return val;
238}
239
240
241// Unpack flattened list from the convention used in TypedListProperty

Callers 4

readNextBigEndianMethod · 0.85
readNextBigEndianMethod · 0.85

Calls 1

swapFunction · 0.50

Tested by

no test coverage detected