Re: [PATCH] bswap.h: Move the overwriting of the ntohl*/ htonl* macros.

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

 



Sebastian Andrzej Siewior <sebastian@xxxxxxxxxxxxx> 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).




[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