![]() ![]() | ![]() |
File: [local] / prex-old / dev / lib / htons.c (download)
Revision 1.1.1.1 (vendor branch), Tue Jun 3 09:38:42 2008 UTC (16 years, 3 months ago) by nbrk
Yeah, this is an initial import of Prex, portable real-time microkernel operating system. I wanna hack it for non-profit but fun, so let it in. |
/* * Written by J.T. Conklin <jtc@NetBSD.org>. * Public domain. */ #include <driver.h> #include <sys/types.h> #undef htons uint16_t htons(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 }