From 34940b76018eed3ac3fe6f6db37637390880055b Mon Sep 17 00:00:00 2001
From: Thomas Perl <m@thp.io>
Date: Sat, 26 Sep 2020 17:12:19 +0200
Subject: [PATCH] Remove byteswap.h dependency (not available on macOS/BSD)

---
 DISTFILES         |  1 -
 import/byteswap.h | 41 -----------------------------------------
 src/defines.h     |  4 ++--
 src/index.h       |  1 -
 4 files changed, 2 insertions(+), 45 deletions(-)
 delete mode 100644 import/byteswap.h

diff --git a/DISTFILES b/DISTFILES
index 0a7ff78..7379871 100644
--- DISTFILES
+++ DISTFILES
@@ -39,7 +39,6 @@ icons/play.png
 icons/play.svgz
 icons/stop.png
 icons/stop.svgz
-import/byteswap.h
 import/stdlib.cpp
 import/stdlib.h
 import/sys/mman.h
diff --git a/import/byteswap.h b/import/byteswap.h
deleted file mode 100644
index ac4b3ad..0000000
--- import/byteswap.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* byteswap.h
-
-Copyright 2005 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#ifndef _BYTESWAP_H
-#define _BYTESWAP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define __bswap_constant_16 __bswap_16
-#define __bswap_constant_32 __bswap_32
-#define __bswap_constant_64 __bswap_64
-#define __bswap_16(x) \
-     ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
-
-#define __bswap_32(x) \
-      ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |               \
-       (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
-
-
-#define __bswap_64(x) \
-     ((((x) & 0xff00000000000000ull) >> 56)				      \
-      | (((x) & 0x00ff000000000000ull) >> 40)				      \
-      | (((x) & 0x0000ff0000000000ull) >> 24)				      \
-      | (((x) & 0x000000ff00000000ull) >> 8)				      \
-      | (((x) & 0x00000000ff000000ull) << 8)				      \
-      | (((x) & 0x0000000000ff0000ull) << 24)				      \
-      | (((x) & 0x000000000000ff00ull) << 40)				      \
-      | (((x) & 0x00000000000000ffull) << 56))
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _BYTESWAP_H */
diff --git a/src/defines.h b/src/defines.h
index 253e7bb..b612950 100644
--- src/defines.h
+++ src/defines.h
@@ -46,9 +46,9 @@ static inline int videostream(int s=0)
 #define mbo32(x) \
       ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
        (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
-#define htom32(x) (__bswap_32(x))
+#define htom32(x) mbo32(x)
 #define mbo16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
-#define htom16(x) (__bswap_16(x))
+#define htom16(x) mbo16(x)
 #else
 #define mbo32(x) (x)
 #define htom32(x) (x)
diff --git a/src/index.h b/src/index.h
index 44999a9..c70ddea 100644
--- src/index.h
+++ src/index.h
@@ -22,7 +22,6 @@
 #define _DVBCUT_INDEX_H
 
 #include <stdint.h>
-#include <byteswap.h>
 #include <set>
 #include <vector>
 #include "types.h"
