From 316385e018739813a7f1b6de777974be5572de03 Mon Sep 17 00:00:00 2001 From: Pentium44 Date: Wed, 7 Apr 2021 20:08:12 -0700 Subject: [PATCH] OSX header file --- src/deps.h | 2 +- src/sbyteswap.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/sbyteswap.h diff --git a/src/deps.h b/src/deps.h index c711286..3cc8629 100644 --- a/src/deps.h +++ b/src/deps.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include "sbyteswap.h" #include // Networking #include diff --git a/src/sbyteswap.h b/src/sbyteswap.h new file mode 100644 index 0000000..cd1daeb --- /dev/null +++ b/src/sbyteswap.h @@ -0,0 +1,23 @@ +// a) As Mac OS X does not have byteswap.h +// needed this for a c util I had used over the years on linux. +// did not find a solution to stopgap via macports, sadly, but this did the trick + +#if HAVE_BYTESWAP_H +#include +#else +#define bswap_16(value) \ +((((value) & 0xff) << 8) | ((value) >> 8)) + +#define bswap_32(value) \ +(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \ +(uint32_t)bswap_16((uint16_t)((value) >> 16))) + +#define bswap_64(value) \ +(((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \ +<< 32) | \ +(uint64_t)bswap_32((uint32_t)((value) >> 32))) +#endif + + +(b) change this line 357 to +while((c = getopt(argc, argv, "hvi::o::p:k::")) != -1){