[En-Nut-Discussion] IP Checksum calculation broken. Reenabled old algorithm for the meantime.
Harald Kipp
harald.kipp at egnite.de
Fri Jul 6 13:22:39 CEST 2012
Hi Ole,
On 06.07.2012 12:10, Ole Reinhardt wrote:
> just an idea on this generic vs. architecture specific IP checksum
> calculation. Couldn't we mark the NutIpChkSumPartial() as weak, so any
> architecture could overwrite it with it's own code supplied in the emac
> driver file? Or is this a gcc specific extension?
As far as I know, weak declarations are not language, but linker specific. Furthermore, the __attribute__ keyword is GCC specific.
Anyway, I do not have any problems with toolchain specific declarations in general. As long as you can make sure, that the code will still compile and link with other C89 tools. In its most simple form:
#ifdef __GNUC__
extern uint16_t NutIpChkSumPartial(uint16_t ics, CONST void *buf, int len) __attribute__ ((weak));
#else
extern uint16_t NutIpChkSumPartial(uint16_t ics, CONST void *buf, int len);
#endif
Regards,
Harald
More information about the En-Nut-Discussion
mailing list