typedef unsigned char Byte; ... void ReverseBytes( void *start, int size ) { Byte *buffer = (Byte *)(start); for( int i = 0; i < size / 2; i++ ) {
The standard library has a std::reverse function:
#include void ReverseBytes( void *start, int size ) { char *istart = start, *iend = istart + size; std::reverse(istart, iend); }