Skip to content
Snippets Groups Projects
Commit 51df12be authored by Tommy Persson's avatar Tommy Persson
Browse files

Adding network byte order.

parent 3130af38
No related branches found
No related tags found
No related merge requests found
......@@ -55,8 +55,8 @@ float bytesToFloat(unsigned char b0, unsigned char b1, unsigned char b2, unsign
double bytesToDouble(unsigned char b0, unsigned char b1, unsigned char b2, unsigned char b3,
unsigned char b4, unsigned char b5, unsigned char b6, unsigned char b7) {
// unsigned char byte_array[] = { b3, b2, b1, b0 };
unsigned char byte_array[] = { b0, b1, b2, b3, b4, b5, b6, b7 };
//unsigned char byte_array[] = { b0, b1, b2, b3, b4, b5, b6, b7 };
unsigned char byte_array[] = { b7, b6, b5, b4, b3, b2, b1, b0 }; //netw byte order
double result;
std::copy(reinterpret_cast<const char*>(&byte_array[0]),
reinterpret_cast<const char*>(&byte_array[8]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment