File:  [DVB] / dietlibc / lib / htonl.c
Revision 1.5: download - view: text, annotated - select for diffs
Tue Aug 19 16:32:23 2003 UTC (20 years, 9 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
two more 64-bit fixes to make RPC work

#include <endian.h>
#include <netinet/in.h>

uint32_t htonl(uint32_t hostlong) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
  return (hostlong>>24) | ((hostlong&0xff0000)>>8) |
	  ((hostlong&0xff00)<<8) | (hostlong<<24);
#else
  return hostlong;
#endif
}

uint32_t ntohl(uint32_t hostlong) __attribute__((weak,alias("htonl")));

LinuxTV legacy CVS <linuxtv.org/cvs>