ports/games/Doom64EX/files/patch-include_imp_util_Endian
Piotr Kubaj 7d5953d809 games/Doom64EX: fix build
/wrkdirs/usr/ports/games/Doom64EX/work/Doom64EX-03a5e6a5a3a14d66886f62b72431b37ef7336706/include/imp/util/Endian:64:12: error: use of undeclared identifier 'bswap16'
   64 |   { return bswap16(x); }
      |            ^
2024-06-15 12:09:35 +02:00

38 lines
960 B
Text

--- include/imp/util/Endian.orig 2018-08-24 09:23:34 UTC
+++ include/imp/util/Endian
@@ -12,6 +12,8 @@
# define BYTE_ORDER LITTLE_ENDIAN
#elif defined(__APPLE__)
# include <machine/endian.h>
+#elif defined(__FreeBSD__)
+# include <sys/endian.h>
#else
# include <endian.h>
#endif
@@ -57,6 +59,26 @@ namespace imp {
inline uint64 swap_bytes(uint64 x) noexcept
{ return OSSwapInt64(x); }
+}
+#elif defined(__FreeBSD__)
+namespace imp {
+ inline int16 swap_bytes(int16 x) noexcept
+ { return bswap16(x); }
+
+ inline uint16 swap_bytes(uint16 x) noexcept
+ { return bswap16(x); }
+
+ inline int32 swap_bytes(int32 x) noexcept
+ { return bswap32(x); }
+
+ inline uint32 swap_bytes(uint32 x) noexcept
+ { return bswap32(x); }
+
+ inline int64 swap_bytes(int64 x) noexcept
+ { return bswap64(x); }
+
+ inline uint64 swap_bytes(uint64 x) noexcept
+ { return bswap64(x); }
}
#elif defined(__GNUC__) || defined(__clang__)
namespace imp {