From: Junio C Hamano <gitster@pobox.com>
To: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] bswap.h: Move the overwriting of the ntohl*/ htonl* macros.
Date: Fri, 06 Jun 2025 15:36:23 -0700 [thread overview]
Message-ID: <xmqqcybg1orc.fsf@gitster.g> (raw)
In-Reply-To: <20250606220455.jhicNLuK@breakpoint.cc> (Sebastian Andrzej Siewior's message of "Sat, 7 Jun 2025 00:04:55 +0200")
Sebastian Andrzej Siewior <sebastian@breakpoint.cc> writes:
>> ... we undefine these two macros for _everybody_ here. Also let me
>> take a mental note that we only undef these 64-bit functions and
>> leave ntohl/htonl intact.
>
> How so? The ntohl/ htonl are also replaced with bswap32 Or do I miss
> something.
Only sometimes, unlike the 64-bit one that is always replaced.
>> > #undef ntohll
>> > #undef htonll
>>
>> This is related to the "oddity" I'll mention at the end.
>> > +# if defined(bswap32)
>> > +# undef ntohl
>> > +# undef htonl
>> > +# define ntohl(x) bswap32(x)
>> > +# define htonl(x) bswap32(x)
>> > +# endif
This is ntohl/htonl thing. Because we do not have
default_bswap32(), unlike the 64-bit side, we do not touch
ntohl/htonl when bswap32 is not available.
That is the oddity I mentioned.
> Ah, the ntohll/ htonll gets undef and defined later. That is the
> "oddity" as you put it.
> Do you want this reposted with an improved commit message or do you want
> also the undef for ntohll and the identity define removed since it is
> not required?
I do not have a strong preference either way myself. As long as it
is clearly documented what we are doing here (e.g., we probably
should tell anybody who includes this header file that bswap32 and
bswap64 are an implementation detail inside this file and they
should not use them themselves, or something like that).
next prev parent reply other threads:[~2025-06-06 22:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 16:57 [PATCH] bswap.h: Move the overwriting of the ntohl*/ htonl* macros Sebastian Andrzej Siewior
2025-06-06 21:05 ` Junio C Hamano
2025-06-06 22:04 ` Sebastian Andrzej Siewior
2025-06-06 22:36 ` Junio C Hamano [this message]
2025-06-07 21:02 ` Junio C Hamano
2025-06-09 21:57 ` 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=xmqqcybg1orc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=sebastian@breakpoint.cc \
/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).