File:  [DVB] / dietlibc / lib / htons.c
Revision 1.7: 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>

uint16_t htons(uint16_t hostshort) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
  return ((hostshort>>8)&0xff) | (hostshort<<8);
#else
  return hostshort;
#endif
}

uint16_t ntohs(uint16_t hostshort) __attribute__((weak,alias("htons")));

LinuxTV legacy CVS <linuxtv.org/cvs>