diff options
Diffstat (limited to 'src/network/ntohs.c')
-rw-r--r-- | src/network/ntohs.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/ntohs.c b/src/network/ntohs.c new file mode 100644 index 00000000..3544a479 --- /dev/null +++ b/src/network/ntohs.c @@ -0,0 +1,10 @@ +#include <netinet/in.h> + +uint16_t ntohs(uint16_t n) +{ + union { + uint16_t s; + uint8_t b[2]; + } u = { n }; + return (u.b[0]<<8) | u.b[1]; +} |