Closed oerdnj closed 7 years ago
Instead of using own endianess conversion code, just use ntohl() which is exactly the thing you want.
ntohl()
This variant uses alignment safe code, but if you are sure, this will be always aligned, the memcpy() part can be safely dropped.
memcpy()
In case this might not be aligned, even the original code might be wrong on some architectures (the (uint *) conversion).
(uint *)
Thanks a lot!
Instead of using own endianess conversion code, just use
ntohl()
which is exactly the thing you want.This variant uses alignment safe code, but if you are sure, this will be always aligned, the
memcpy()
part can be safely dropped.In case this might not be aligned, even the original code might be wrong on some architectures (the
(uint *)
conversion).