Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/games/Doom64EX/files/patch-include_imp_util_Endian
16461 views
--- 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 {