Re: [PATCH 3/3] compat/bswap.h: Detect endianness from XL C compiler macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 26, 2014 at 01:34:26PM -0400, David Michael wrote:

> diff --git a/compat/bswap.h b/compat/bswap.h
> index f6fd9a6..7fed637 100644
> --- a/compat/bswap.h
> +++ b/compat/bswap.h
> @@ -122,6 +122,10 @@ static inline uint64_t git_bswap64(uint64_t x)
>  #  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
>  # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
>  #  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
> +# elif defined(__THW_BIG_ENDIAN__) && !defined(__THW_LITTLE_ENDIAN__)
> +#  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
> +# elif defined(__THW_LITTLE_ENDIAN__) && !defined(__THW_BIG_ENDIAN__)
> +#  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN

Out of curiosity, is there ever a case where _both_ are defined? That
is, would:

diff --git a/compat/bswap.h b/compat/bswap.h
index f6fd9a6..b78a0bd 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -122,6 +122,10 @@ static inline uint64_t git_bswap64(uint64_t x)
 #  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
 # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
 #  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
+# elif defined(__THW_BIG_ENDIAN__)
+#  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
+# elif defined(__THW_LITTLE_ENDIAN__)
+#  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
 # else
 #  error "Cannot determine endianness"
 # endif

be enough, or is that used to mark some other special case? Even if not,
there is not much downside to the more thorough conditions you put
above, but as a reviewer I wondered if there is something else going on.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]