git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add extra logic required to detect endianness on Solaris
@ 2014-05-01  7:43 Charles Bailey
  2014-05-01 18:58 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Charles Bailey @ 2014-05-01  7:43 UTC (permalink / raw)
  To: git; +Cc: Charles Bailey

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
---

The endian detection added in 7e3dae494 isn't sufficient for the Solaris
Studio compilers. This adds some fallback logic which works for Solaris
but would also work for AIX and Linux if it were needed.

 compat/bswap.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/compat/bswap.h b/compat/bswap.h
index 120c6c1..5a41311 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -110,6 +110,27 @@ static inline uint64_t git_bswap64(uint64_t x)
 #endif
 
 #if !defined(__BYTE_ORDER)
+/* Known to be needed on Solaris but designed to potentially more portable */
+
+#if !defined(__BIG_ENDIAN)
+#define __BIG_ENDIAN 4321
+#endif
+
+#if !defined(__LITTLE_ENDIAN)
+#define __LITTLE_ENDIAN 1234
+#endif
+
+#if defined(_BIG_ENDIAN)
+#define __BYTE_ORDER __BIG_ENDIAN
+#endif
+
+#if defined(_LITTLE_ENDIAN)
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* !defined(__BYTE_ORDER) */
+
+#if !defined(__BYTE_ORDER)
 # error "Cannot determine endianness"
 #endif
 
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-05-02 20:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-01  7:43 [PATCH] Add extra logic required to detect endianness on Solaris Charles Bailey
2014-05-01 18:58 ` Junio C Hamano
2014-05-01 19:18   ` Junio C Hamano
2014-05-01 19:22     ` Junio C Hamano
2014-05-02  7:49   ` Charles Bailey
2014-05-02  7:55     ` [PATCH] Detect endianness on more platforms that don't use BYTE_ORDER Charles Bailey
2014-05-02 16:48       ` Junio C Hamano
2014-05-02 16:58         ` Charles Bailey
2014-05-02 19:34           ` Junio C Hamano
2014-05-02 19:43             ` Junio C Hamano
2014-05-02 20:02               ` Charles Bailey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).