From a9b98ed0577a7916d09435ac7939a85eec798ec6 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 5 Jun 2015 19:07:01 -0400 Subject: [PATCH] Add 64-bit ntoh/hton functions for Linux BSD macros aren't tested, but should work. These should already be defined on Windows. --- common/types.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/types.h b/common/types.h index 9064b67e0..2e1b5d3f3 100644 --- a/common/types.h +++ b/common/types.h @@ -83,4 +83,20 @@ typedef const char Const_char; //for perl XS #define DLLFUNC extern "C" #endif +// htonll and ntohll already defined on windows +#ifndef WIN32 +# if defined(__linux__) +# include +# elif defined(__FreeBSD__) || defined(__NetBSD__) +# include +# elif defined (__OpenBSD__) +# include +# define be16toh(x) betoh16(x) +# define be32toh(x) betoh32(x) +# define be64toh(x) betoh64(x) +# endif +# define htonll(x) htobe64(x) +# define ntohll(x) be64toh(x) +#endif + #endif