error in ppp.h

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

error in ppp.h

Heike-2
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); \
}


_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel