KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
typedef unsigned char Byte; ... void ReverseBytes( void *start, int size ) { Byte *buffer = (Byte *)(start); for( int i = 0; i < size / 2; i++ ) { std::swap( buffer[i], buffer[size - i - 1] ); } } What this method does right now is it reverses bytes in memory. What I would like to know is, is there a better way to get the same effect? The whole "size / 2" part seems like a bad thing, but I'm not sure. EDIT: I just realized how bad the title I put for this question was, so I [hopefully] fixed it.
Tags (comma-separated)
Save Edits
Cancel