we can do this without violating the namespace now that they are macros/inline functions rather than extern functions. the motivation is that gcc was generating giant, slow, horrible code for the old functions, and now generates a single byte-swapping instruction.
8 lines
146 B
C
8 lines
146 B
C
#include <netinet/in.h>
|
|
#include <byteswap.h>
|
|
|
|
uint32_t ntohl(uint32_t n)
|
|
{
|
|
union { int i; char c; } u = { 1 };
|
|
return u.c ? bswap_32(n) : n;
|
|
}
|