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

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

 



On Tue, Nov 10, 2020 at 2:58 PM Johannes Schindelin
<Johannes.Schindelin@xxxxxx> 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.

> > 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



[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]

  Powered by Linux