From: Junio C Hamano <gitster@pobox•com>
To: Sebastian Andrzej Siewior <sebastian@breakpoint•cc>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v2 0/6] bswap.h: Rework ntohl handling
Date: Mon, 07 Jul 2025 15:43:20 -0700 [thread overview]
Message-ID: <xmqqo6tv1v1z.fsf@gitster.g> (raw)
In-Reply-To: <20250611221444.1567638-1-sebastian@breakpoint.cc> (Sebastian Andrzej Siewior's message of "Thu, 12 Jun 2025 00:14:36 +0200")
Sebastian Andrzej Siewior <sebastian@breakpoint•cc> writes:
> since the add of bswap32/64() support based on __builtin support, the
> usage of ntohl() macros is broken on big endian machines because the
> macros are always overwritten providing a swap.
>
> The first patch in the series reverts the change and the following
> patches try to improve the situation by allowing to always provide an
> optimized version.
>
> I've been looking at recent compiler and they manage to recognize the
> manual shifting and use an optimize opcode if available. The ntohl
> version provided by glibc already provides an "optimized" version which
> makes an optimisation in git almost not needed.
> One of the motivation behind overwriting/ providing an optimized
> version was to provide a macro instead of using a function call. One
> libc that is still providing ntohl as a function call is musl. So it
> might makes sense to keep it.
> While ntohl() is provided by the libc, the ntohll() is not. I found it
> only on Windows provided by winsock.h.
>
> I haven't touched the put/get_be*() macros. gcc & clang are both smart
> enough to swap the content accordingly and perform a single store/ load.
> Only the msvc seems to strugle here and performs multiple bytes stores/
> loads and shifts.
Now, I see many comments and suggestions on the thread since this v2
iteration was posted:
https://lore.kernel.org/git/20250611221444.1567638-1-sebastian@breakpoint.cc/
and I think the ball is in the author's court to respond.
I'll mark the topic as Stalled in the draft of the next issue of
"What's cooking" report.
Thanks.
next prev parent reply other threads:[~2025-07-07 22:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 22:14 [PATCH v2 0/6] bswap.h: Rework ntohl handling Sebastian Andrzej Siewior
2025-06-11 22:14 ` [PATCH v2 1/6] Revert "bswap.h: add support for built-in bswap functions" Sebastian Andrzej Siewior
2025-06-12 20:04 ` Junio C Hamano
2025-06-11 22:14 ` [PATCH v2 2/6] bswap.h: Add support for __BYTE_ORDER__ Sebastian Andrzej Siewior
2025-06-12 0:24 ` brian m. carlson
2025-06-12 0:43 ` Collin Funk
2025-06-12 20:10 ` Junio C Hamano
2025-06-11 22:14 ` [PATCH v2 3/6] bswap.h: Define GIT_LITTLE_ENDIAN on msvc as little endian Sebastian Andrzej Siewior
2025-06-12 20:11 ` Junio C Hamano
2025-06-11 22:14 ` [PATCH v2 4/6] bswap.h: Always overwrite ntohl/ ntohll macros Sebastian Andrzej Siewior
2025-06-12 0:14 ` brian m. carlson
2025-06-12 20:16 ` Junio C Hamano
2025-06-11 22:14 ` [PATCH v2 5/6] bswap.h: Remove optimized x86 version of bswap32/64 Sebastian Andrzej Siewior
2025-06-26 15:55 ` Kristoffer Haugsbakk
2025-07-15 19:02 ` Sebastian Andrzej Siewior
2025-06-11 22:14 ` [PATCH v2 5/6] bswap: " Sebastian Andrzej Siewior
2025-06-11 22:14 ` [PATCH v2 6/6] bswap.h: Provide a built-in based version of bswap32/64 if possible Sebastian Andrzej Siewior
2025-06-12 20:21 ` [PATCH v2 0/6] bswap.h: Rework ntohl handling Junio C Hamano
2025-07-07 22:43 ` Junio C Hamano [this message]
2025-07-09 6:04 ` Sebastian Andrzej Siewior
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=xmqqo6tv1v1z.fsf@gitster.g \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sebastian@breakpoint$(echo .)cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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