Wireshark mailing list archives

Re: [Wireshark-commits] rev 32929 - (ENC_*_ENDIAN vs FI_*_ENDIAN)


From: Jakub Zawadzki <darkjames () darkjames ath cx>
Date: Tue, 1 Jun 2010 20:51:08 +0200

On Tue, Jun 01, 2010 at 11:19:05AM -0700, Guy Harris wrote:
I'm not sure if I understand this comment properly...

I could instead of using (FI_LITTLE_ENDIAN, FI_BIG_ENDIAN) use (ENC_LITTLE_ENDIAN, ENC_BIG_ENDIAN, ENC_NA),
and do FI_SET_FLAG(new_fi, encoding) (if it is what comment suggest)

That's not what it suggests.  The FI_

It suggests doing

      FI_SET_FLAG(new_fi, (encoding & ENC_LITTLE_ENDIAN) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN);

instead of

      FI_SET_FLAG(new_fi, (encoding) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN);

Thanks for reply, I was confused what REP_*_ENDIAN bit means.

but ENC_LITTLE_ENDIAN should have different value than ENC_NA
(preferably ENC_LITTLE_ENDIAN != 0)

It *does* have a different value, because it *is* != 0:

$ egrep ENC_ epan/proto.h
 * So, for now, we define ENC_BIG_ENDIAN and ENC_LITTLE_ENDIAN as
 * the same.  We therefore define ENC_BIG_ENDIAN as 0x00000000 and
 * ENC_LITTLE_ENDIAN as 0x80000000 - we're using the high-order bit
 * have ENC_NA (for "Not Applicable").
#define ENC_BIG_ENDIAN                0x00000000
#define ENC_LITTLE_ENDIAN     0x80000000
#define ENC_NA                        0x00000000

Note the "8" after the "0x".

My bad :) I was thinking about (ENC_BIG_ENDIAN != ENC_NA && ENC_BIG_ENDIAN != 0)
But if encoding value won't be used directly in FI_SET_FLAG() it's not important.

Regards.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: