depot/third_party/nixpkgs/pkgs/development/libraries/libdevil/0001-il_endian.h-Fix-endian-handling.patch
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

35 lines
1.2 KiB
Diff

From 85ca659a59ae5be6fc0824b0684967ec94727e2a Mon Sep 17 00:00:00 2001
From: toonn <toonn@toonn.io>
Date: Wed, 12 Jun 2024 11:39:35 +0000
Subject: [PATCH] il_endian.h: Fix endian handling
Based on https://sourceforge.net/p/resil/tickets/8/, which has also been
incorporated in the MacPort for libdevil 1.7.8,
https://trac.macports.org/export/154482/trunk/dports/devel/libdevil/files/patch-src-IL-include-il_endian.h.diff,
but updated for the header included in release 1.8.0 of libdevil.
---
src-IL/include/il_endian.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src-IL/include/il_endian.h b/src-IL/include/il_endian.h
index c4e6d86..a3cd57f 100644
--- a/src-IL/include/il_endian.h
+++ b/src-IL/include/il_endian.h
@@ -23,9 +23,13 @@ extern "C" {
#ifndef __BIG_ENDIAN__
#define __BIG_ENDIAN__ 1
#endif
+#else
+#ifndef __LITTLE_ENDIAN__
+#define __LITTLE_ENDIAN__ 1
+#endif
#endif
-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
+#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \
|| (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
#undef __LITTLE_ENDIAN__
#define Short(s) iSwapShort(s)
--
2.44.0