Skip to content

Commit

Permalink
Windows warning checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Oct 16, 2023
1 parent 16b4913 commit d9b0ba1
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/include/ndpi_define.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -394,33 +394,103 @@ static inline u_int64_t get_u_int64_t(const u_int8_t* X, int O)

#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

#ifndef htobe16
#define htobe16(x) htons(x)
#endif

#ifndef htole16
#define htole16(x) (x)
#endif

#ifndef be16toh
#define be16toh(x) ntohs(x)
#endif

#ifndef le16toh
#define le16toh(x) (x)
#endif

#ifndef htobe32
#define htobe32(x) htonl(x)
#endif

#ifndef htole32
#define htole32(x) (x)
#endif

#ifndef be32toh
#define be32toh(x) ntohl(x)
#endif

#ifndef le32toh
#define le32toh(x) (x)
#endif

#ifndef htobe64
#define htobe64(x) ndpi_htonll(x)
#endif

#ifndef htole64
#define htole64(x) (x)
#endif

#ifndef be64toh
#define be64toh(x) ndpi_ntohll(x)
#endif

#ifndef le64toh
#define le64toh(x) (x)
#endif

#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__

#ifndef htobe16
#define htobe16(x) (x)
#endif

#ifndef htole16
#define htole16(x) __builtin_bswap16(x)
#endif

#ifndef be16toh
#define be16toh(x) (x)
#endif

#ifndef le16toh
#define le16toh(x) __builtin_bswap16(x)
#endif

#ifndef htobe32
#define htobe32(x) (x)
#endif

#ifndef htole32
#define htole32(x) __builtin_bswap32(x)
#endif

#ifndef be32toh
#define be32toh(x) (x)
#endif

#ifndef le32toh
#define le32toh(x) __builtin_bswap32(x)
#endif

#ifndef htobe64
#define htobe64(x) (x)
#endif

#ifndef htole64
#define htole64(x) __builtin_bswap64(x)
#endif

#ifndef be64toh
#define be64toh(x) (x)
#endif

#ifndef le64toh
#define le64toh(x) __builtin_bswap64(x)
#endif

#else
#error Unexpected __BYTE_ORDER__
Expand Down

0 comments on commit d9b0ba1

Please sign in to comment.