Wireshark-dev: Re: [Wireshark-dev] Merging wiretap pint macro to wsutil/pint.h

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 18 Nov 2013 15:34:44 -0800
On Nov 17, 2013, at 11:06 PM, Michal Labedzki <michal.labedzki@xxxxxxxxx> wrote:

> Regarding naming: As long as there is command like tvb_get_ntoh24 [40,
> 48, 54 and 64] (see also tvbuff.h) I will prefer to using number of
> bits in the rest of commands.

Does that include tvb_get_ntohl() (and the "ntohs" and "htons" macros)?

> By the way Jakub, what is size of "ll" on 16,32 and 64 bit
> architecture? Is there any specification ensure that it cannot be
> bigger than 64 bit?

On 64-bit UN*Xes, "ntohl()" and "htonl()" act on data values shorter than a "long", so the "l" in "ntohl" and "htonl" are historical (dating back to 2.x BSD, running on PDP-11s, where you *did* need "long" to get 32-bit values); the same could be said about "ll".

I think using the number of bits is cleaner, but going that way everywhere, not just in those macros, *would* be a major change (mechanical, but still a change).