MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / swapByteOrder

Function swapByteOrder

Tools/FoamGenerator/main.cpp:1099–1105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1097// VTK expects big endian
1098template<typename T>
1099inline void swapByteOrder(T* v)
1100{
1101 constexpr size_t n = sizeof(T);
1102 uint8_t* bytes = reinterpret_cast<uint8_t*>(v);
1103 for (unsigned int c = 0u; c < n / 2; c++)
1104 std::swap(bytes[c], bytes[n - c - 1]);
1105}
1106
1107void writeParticlesVTK(const std::string& fileName, const unsigned int numParticles, const Vector3r* particlePositions)
1108{

Callers 1

writeParticlesVTKFunction · 0.70

Calls 1

swapFunction · 0.50

Tested by

no test coverage detected