File: byteorder.c

package info (click to toggle)
haskell-io-streams-haproxy 1.0.1.0-6
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 152 kB
  • sloc: haskell: 789; ansic: 18; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Sigh. According to the docs for <arpa/inet.h>, htonl() and friends may be
   implemented as macros only, so I have to re-export functions here to do the
   conversions. */

#if defined(WINDOWS)
#  include <winsock2.h>
#  include <inttypes.h>
#else
#  include <arpa/inet.h>
#endif

uint32_t iostreams_htonl(uint32_t hostlong) {
    return htonl(hostlong);
}

uint16_t iostreams_htons(uint16_t hostshort) {
    return htons(hostshort);
}

uint32_t iostreams_ntohl(uint32_t netlong) {
    return ntohl(netlong);
}

uint16_t iostreams_ntohs(uint16_t netshort) {
    return ntohs(netshort);
}