[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-devel] Code cleanups for 1.4.0
From: |
Bill Auerbach |
Subject: |
RE: [lwip-devel] Code cleanups for 1.4.0 |
Date: |
Mon, 28 Jun 2010 09:55:34 -0400 |
>Having had a look at the code I have to agree with the compiler. It's
>complaining about mixing of logical and bitwise operators, e.g. we have
>things like this:
>
>#define SNMP_ASN1_UNIV (!0x80 | !0x40)
>#define SNMP_ASN1_APPLIC (!0x80 | 0x40)
>#define SNMP_ASN1_CONTXT ( 0x80 | !0x40)
>
>#define SNMP_ASN1_CONSTR (0x20)
>#define SNMP_ASN1_PRIMIT (!0x20)
All of the !0x80, !0x40, and !0x20 result in 0 (as you know). So remove these
and you have:
#define SNMP_ASN1_UNIV (0)
#define SNMP_ASN1_APPLIC (0x40)
#define SNMP_ASN1_CONTXT (0x80)
#define SNMP_ASN1_CONSTR (0x20)
#define SNMP_ASN1_PRIMIT (0)
Which keeps each #define for a case unqique (for the switch statement). I
think the intent was to show the bit fields allowed for the ASN1 but to get
unique values for cases.
The code is probably correct if not unusual. :-)
Bill