lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] error in ppp.h


From: Heike
Subject: [lwip-devel] error in ppp.h
Date: Tue, 12 Dec 2006 16:01:23 +0100
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)

Hi,

the following macros in ppp.h were changed in the new lwIP 1.2.0, but
(s) = *(cp)++ << 8;  is not the same like (s) = *(cp); (cp)++; (s) << 8;

(s) = *(cp)++ << 8; the pointer is incremented an then the dereferenced value shifted (s) = *(cp); (cp)++; (s) << 8; here the pointer is incremented, but it has no affect to the shifted value!

right?

best regards

Heike



lwip 1.1.1 in ppp.h:

#define GETSHORT(s, cp) { \
    (s) = *(cp)++ << 8; \
    (s) |= *(cp)++; \
}
#define PUTSHORT(s, cp) { \
    *(cp)++ = (u_char) ((s) >> 8); \
    *(cp)++ = (u_char) (s); \
}

#define GETLONG(l, cp) { \
    (l) = *(cp)++ << 8; \
    (l) |= *(cp)++; (l) <<= 8; \
    (l) |= *(cp)++; (l) <<= 8; \
    (l) |= *(cp)++; \
}
#define PUTLONG(l, cp) { \
    *(cp)++ = (u_char) ((l) >> 24); \
    *(cp)++ = (u_char) ((l) >> 16); \
    *(cp)++ = (u_char) ((l) >> 8); \
    *(cp)++ = (u_char) (l); \
}

lwip 1.2.0 in ppp.h:

#define GETSHORT(s, cp) { \
    (s) = *(cp); (cp)++; (s) << 8; \
    (s) |= *(cp); (cp)++; \
}
#define PUTSHORT(s, cp) { \
    *(cp)++ = (u_char) ((s) >> 8); \
    *(cp)++ = (u_char) (s); \
}

#define GETLONG(l, cp) { \
    (l) = *(cp); (cp)++; (l) << 8; \
    (l) |= *(cp); (cp)++; (l) <<= 8; \
    (l) |= *(cp); (cp)++; (l) <<= 8; \
    (l) |= *(cp); (cp)++; \
}
#define PUTLONG(l, cp) { \
    *(cp)++ = (u_char) ((l) >> 24); \
    *(cp)++ = (u_char) ((l) >> 16); \
    *(cp)++ = (u_char) ((l) >> 8); \
    *(cp)++ = (u_char) (l); \
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]