Reading bits in far too many ways
It turns out that MSB-first and LSB-first packing conventions both have advantages and disadvantages, and it’s much more useful to think of them as tools with different areas of application than it is to designate one as the “right way” and the other as the “wrong way”. - The ryg blog part 1 / 2 / 3
see also
- htonl() vs __builtin_bswap32() - reverse byte order depending or not on localhost architecture
- htonl == host to network long / htons => short / htoll => u64 ?
- Is there a difference between ntohl() and htonl() ? => They do the exact same thing but have 2 different names. It doesn’t matter which one you call.
- GNU C has a uint64_t __builtin_bswap64 (uint64_t x)
- std::byteswap - since C++23
Written on September 30, 2018, Last update on February 16, 2023
bits
c++
blog
network