-
-
Save pmj/b44d052bcbf5576977f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float rawBytesToFloat(const char* _buffer) | |
{ | |
static_assert(sizeof(u_long_type) == sizeof(float),"sizes must match!"); | |
u_long_type net_int; | |
memcpy(&net_int, _buffer, sizeof(net_int)); | |
u_long_type host_int = asio::detail::socket_ops::network_to_host_long(net_int); | |
float result; | |
memcpy(&result, &host_int, sizeof(result)); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment