git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] compat/bswap.h: detect ARM64 when using MSVC

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Nov 10, 2020, 16:44 UTC
Message-ID
<CAHGBnuM3JeffB73coQhVOC03tiWhg2VY=teSr-Jmnx5-aX48BA@mail.gmail.com>
In-Reply-To
<nycvar.QRO.7.76.6.2011101418550.18437@tvgsbejvaqbjf.bet>

On Tue, Nov 10, 2020 at 2:58 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

> > -#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
> > +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))
> I Cc:ed Sebastian, to confirm my hunch: Looking a bit above that hunk, I
> see that this merely imitates the way things are done for GCC:
>
>     #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))

I believe my intention was not necessarily to imitate the way things are done for GCC, but to independently be on the safe side by checking that this code is only used on x86-style / little-endian architecture.

Show 5 quoted lines
> > As far as I know, Windows has always run on little-endian hardware.
>
> I think that depends on your point of view... IIRC an early version of
> Windows NT (or was it still VMS Plus?) ran on DEC Alpha, which I seem to
> _vaguely_ remember was big-endian.

IMO, strictly speaking, from a semantic point of view this is not about which OS we are running on, but about which compiler is being used. So the question here is: Can MSVC compile for a non-little endian target platform (incl. things like cross-compilation)? And AFAIK the answer is yes, it could in the past / still can nowadays.

> Short version: while I managed to convince myself that _currently_ there
> are no big-endian platforms that we can support via MSVC, I would like to
> stay within the boundaries of caution and _not_ drop those `defined(_M_*)`
> parts.

Same here, I'd prefer to keep these for explicitness, and for consistency with the GCC check.

-- 
Sebastian Schuberth
Previous: Johannes SchindelinNext: brian m. carlson
Message 5 of 6 in “compat/bswap.h: detect ARM64 when using MSVC”
  1. compat/bswap.h: detect ARM64 when using MSVCDaniel Gurney, Nov 7, 2020
  2. brian m. carlsonNov 7, 2020
  3. Daniel GurneyNov 7, 2020
  4. Johannes SchindelinNov 10, 2020
  5. Sebastian SchuberthNov 10, 2020
  6. brian m. carlsonNov 10, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.