Re: htole32() and friends

From: Kinkie <kinkie-dev@dont-contact.us>
Date: Tue, 29 Jul 2003 09:09:53 +0200

Robert Collins <robertc@squid-cache.org> writes:

> On Tue, 2003-07-29 at 02:53, Alan Barrett wrote:
>> Wouldn't it be better to use htole{16,32}() and le{16,32}toh() in
>> ntlmauth.h, instead of SSWAP() and WSWAP()?
>>
>> The *SWAP macros have the disadvantage that their name does not match
>> their purpose: their name implies that they swap stuff, but actually
>> they might or might not swap stuff depending on whether it's a big- or
>> little-endian host.
>>
>> The htole* and le*toh functions/macros have the advantage that their
>> name describes exactly what they do: convert from host-byte-order to
>> little-endian, or vice versa. They also have the advantage that they
>> are already included in FreeBSD/NetBSD/OpenBSD.
>>
>> If you like, I'll work up a patch that does as I suggest.
>
> Sounds good to me.

I agree. Those functions were in the pristine (samba-derived) sources, so
if there's anything clearer (and possibly faster) it might very well be used.

-- 
	kinkie (kinkie-squid [at] kinkie [dot] it)
	Random fortune, unrelated to the message:
The good time is approaching,
The season is at hand.
When the merry click of the two-base lick
Will be heard throughout the land.
The frost still lingers on the earth, and
Budless are the trees.
But the merry ring of the voice of spring
Is borne upon the breeze.
		-- Ode to Opening Day, "The Sporting News", 1886
Received on Tue Jul 29 2003 - 01:09:53 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:20:18 MST