Return to htonl.c CVS log | Up to [local] / prex-old / dev / lib |
File: [local] / prex-old / dev / lib / htonl.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 htonl uint32_t htonl(x) uint32_t x; { #if BYTE_ORDER == LITTLE_ENDIAN u_char *s = (u_char *)&x; return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); #else return x; #endif }