4 ms·
Way back, {hton,ntoh}{s,l,ll} didn't originally use C99 types because they predated stdint. Instead, macros and platform specific-isms were used to choose the r
by 1letterunixname 3y ago
Way back, {hton,ntoh}{s,l,ll} didn't originally use C99 types because they predated stdint. Instead, macros and platform specific-isms were used to choose the right types.
As more primitive functions, swap_endian_u{16,32,64,128} are useful to build {hton,ntoh}{s,l,ll}.
IEN-137 is wrong and presented it as a false case of bikeshedding. Standardizing network order on little rather than big endian would save energy. There's no sense to swapping just to swap it back in most cases. That's double work for no reason except intellectual purity. Billions of devices doing a tiny bit of extra work adds up.
- nullc 3y agodepending on the device and instruction set the swap is entirely free, e.g. where it's just a choice of a different load instructions (or the cool arches where you just make an unaligned read, the lsb triggers swapping). If energy is your concern making arches more energy efficient for swapping is the sensible thing as there are already many protocols and file formats in network order. There is fundamentally no reason for it to have a energy cost at all. And if you're really concerned about energy, the energy needed to communicate and store bits usually vastly dominates the energy needed to compute on them. On that basis protocols should be using varrious tightly packed / variable length encodings instead.