![]() ![]() | ![]() |
File: [local] / prex / dev / lib / ntohs.c (download)
Revision 1.1.1.1 (vendor branch), Tue Aug 19 12:46:47 2008 UTC (16 years ago) by nbrk
Initial import of Prex, Portable Real-time Embedded POSIX microkernel system. I have totally new directions in my development (more focused on real hardware, not virtual one). Old hacks are available in prex-old module. They will be carefully re-designed and merged soon. |
/* * Written by J.T. Conklin <jtc@NetBSD.org>. * Public domain. */ #include <driver.h> #include <sys/types.h> #undef ntohs uint16_t ntohs(uint16_t x) { #if BYTE_ORDER == LITTLE_ENDIAN u_char *s = (u_char *) &x; return (uint16_t)(s[0] << 8 | s[1]); #else return x; #endif }