A production issue has led our team to the following questions:
- Under RHEL6 using GCC 4.4.6, how are
ntohsandntohlimplemented? - Are the implementations known to be fast or slow?
- How can I actually see the generated assembly code for the functions?
I know the implications behind questions may seem far-fetched and ridiculous, but I have been asked to investigate.
The hardware in question is an Intel box, little endian, 64-bit processor and compiled in 64 bit.
/usr/include/bits/byteswap.hfor the__bswap_16and__bswap_32functions, which are used when optimization is enabled (see<netinet/in.h>for details of how.)-save-tempsoption to keep the intermediate.sfiles, or use-Sto stop after compilation and before assembling the code, or use http://gcc.godbolt.org/