{"thread":{"id":"54618","subject":"[PATCH] compat/bswap.h: don't assume MSVC is little-endian","startedAt":"2020-11-11T08:33:17Z","lastAt":"2020-11-11T16:40:14Z","messageCount":3,"participants":["Daniel Gurney","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"409591","messageId":"20201111083227.605518-1-dgurney99@gmail.com","threadId":"54618","inReplyTo":null,"subject":"[PATCH] compat/bswap.h: don't assume MSVC is little-endian","fromName":"Daniel Gurney","fromEmail":"dgurney99@gmail.com","sentAt":"2020-11-11T08:32:27Z","receivedAt":"2020-11-11T08:33:17Z","isPatch":true,"sender":{"key":"dgurney99@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12816807?v=4"},"body":"In 1af265f0 (compat/bswap.h: simplify MSVC endianness\ndetection, 2020-11-08) we attempted to simplify code by assuming MSVC\nbuilds will be for little-endian machines, since only unusably old\nversions of MSVC supported big-endian MIPS and m68k architectures.\n\nHowever, it's possible that MSVC could be ported to build for a\nbig-endian architecture again, so the simplification wasn't as\nfuture-proof as hoped.\n\nSo let's go back to the old way of detecting MSVC, and then checking\narchitecture from a list of little-endian architecture macros.\n\nNote that MSVC does not treat ARM64 as bi-endian, so we can safely treat\nit as little-endian.\n\nHelped-by: brian m. carlson <sandals@crustytoothpaste.net>\nHelped-by: Jeff King <peff@peff.net>\nHelped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nHelped-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Daniel Gurney <dgurney99@gmail.com>\n---\n compat/bswap.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/compat/bswap.h b/compat/bswap.h\nindex 72f225eaa8..512f6f4b99 100644\n--- a/compat/bswap.h\n+++ b/compat/bswap.h\n@@ -74,7 +74,7 @@ static inline uint64_t git_bswap64(uint64_t x)\n }\n #endif\n \n-#elif defined(_MSC_VER)\n+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))\n \n #include <stdlib.h>\n \n-- \n2.29.2\n\n"},{"id":"409639","messageId":"nycvar.QRO.7.76.6.2011111723050.18437@tvgsbejvaqbjf.bet","threadId":"54618","inReplyTo":"20201111083227.605518-1-dgurney99@gmail.com","subject":"Re: [PATCH] compat/bswap.h: don't assume MSVC is little-endian","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-11-11T16:23:22Z","receivedAt":"2020-11-11T16:23:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Daniel,\n\nOn Wed, 11 Nov 2020, Daniel Gurney wrote:\n\n> In 1af265f0 (compat/bswap.h: simplify MSVC endianness\n> detection, 2020-11-08) we attempted to simplify code by assuming MSVC\n> builds will be for little-endian machines, since only unusably old\n> versions of MSVC supported big-endian MIPS and m68k architectures.\n>\n> However, it's possible that MSVC could be ported to build for a\n> big-endian architecture again, so the simplification wasn't as\n> future-proof as hoped.\n>\n> So let's go back to the old way of detecting MSVC, and then checking\n> architecture from a list of little-endian architecture macros.\n>\n> Note that MSVC does not treat ARM64 as bi-endian, so we can safely treat\n> it as little-endian.\n>\n> Helped-by: brian m. carlson <sandals@crustytoothpaste.net>\n> Helped-by: Jeff King <peff@peff.net>\n> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> Helped-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Daniel Gurney <dgurney99@gmail.com>\n\nACK!\n\nThank you so much,\nDscho\n\n> ---\n>  compat/bswap.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/compat/bswap.h b/compat/bswap.h\n> index 72f225eaa8..512f6f4b99 100644\n> --- a/compat/bswap.h\n> +++ b/compat/bswap.h\n> @@ -74,7 +74,7 @@ static inline uint64_t git_bswap64(uint64_t x)\n>  }\n>  #endif\n>\n> -#elif defined(_MSC_VER)\n> +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))\n>\n>  #include <stdlib.h>\n>\n> --\n> 2.29.2\n>\n>\n"},{"id":"409645","messageId":"xmqqo8k34zko.fsf@gitster.c.googlers.com","threadId":"54618","inReplyTo":"nycvar.QRO.7.76.6.2011111723050.18437@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] compat/bswap.h: don't assume MSVC is little-endian","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-11-11T16:40:07Z","receivedAt":"2020-11-11T16:40:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> ...\n>> So let's go back to the old way of detecting MSVC, and then checking\n>> architecture from a list of little-endian architecture macros.\n>>\n>> Note that MSVC does not treat ARM64 as bi-endian, so we can safely treat\n>> it as little-endian.\n>>\n>> Helped-by: brian m. carlson <sandals@crustytoothpaste.net>\n>> Helped-by: Jeff King <peff@peff.net>\n>> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>> Helped-by: Junio C Hamano <gitster@pobox.com>\n>> Signed-off-by: Daniel Gurney <dgurney99@gmail.com>\n>\n> ACK!\n>\n> Thank you so much,\n> Dscho\n\nThanks, all.\n"}]}