git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: David Michael <fedora.dm0@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] compat/bswap.h: Detect endianness from XL C compiler macros
Date: Sun, 26 Oct 2014 22:12:25 -0700	[thread overview]
Message-ID: <20141027051225.GB2996@peff.net> (raw)
In-Reply-To: <CAEvUa7mcJhYwivQjbWnVEXj_+fhCS+2edCFWjmEotOXKahQdww@mail.gmail.com>

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

> I'm not 100% sure if __THW_LITTLE_ENDIAN__ will ever be defined, so
> I'd be okay with dropping those references completely.  There is a
> recent version of the compiler for little endian Linux distributions,
> but I haven't found the documentation for it.  (The product
> documentation still seems to only refer to the big endian Linux
> version.)  The compiler's macro may be redundant in this case anyway,
> since Linux systems should have <bits/endian.h> supplying that
> information.
> 
> I only used both macros for completeness; the __THW_BIG_ENDIAN__ macro
> (defined to 1 on z/OS and AIX) is what I actually needed here.  z/OS
> doesn't seem to have any other compile-time byte order indicator,
> short of testing for the OS itself.

Thanks for the explanation.

> Would you prefer the two-line patch to only test for the big endian
> macro,

I think that's OK, as long as the #else case barfs as it does now (i.e.,
doesn't silently choose little-endian).

> or maybe just test for __MVS__ to look at the OS?

If the OS's you're testing on all provide a big-endian marker like
__THW_BIG_ENDIAN__, that seems preferable to me to use, as it's more
explicit. We can deal with similar little-endian systems if and when
somebody sees one in the wild (and your explanation that it would
probably hit the Linux <bits/endian.h> check first makes sense to me).

-Peff

      reply	other threads:[~2014-10-27  5:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 17:34 [PATCH 3/3] compat/bswap.h: Detect endianness from XL C compiler macros David Michael
2014-10-26 18:38 ` Jeff King
2014-10-26 20:04   ` David Michael
2014-10-27  5:12     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141027051225.GB2996@peff.net \
    --to=peff@peff.net \
    --cc=fedora.dm0@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).