mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 00:14:02 +00:00
Trailing dangling byte in checksum should be considered MSB.
This commit is contained in:
parent
319a972e75
commit
6facaf8f05
@ -51,7 +51,7 @@
|
|||||||
/* This is a reference implementation of the checksum algorithm, with the
|
/* This is a reference implementation of the checksum algorithm, with the
|
||||||
* aim of being simple, correct and fully portable. Checksumming is the
|
* aim of being simple, correct and fully portable. Checksumming is the
|
||||||
* first thing you would want to optimize for your platform. You will
|
* first thing you would want to optimize for your platform. You will
|
||||||
* need to port it to your architecture and in your sys_arch.h:\
|
* need to port it to your architecture and in your sys_arch.h:
|
||||||
*
|
*
|
||||||
* #define LWIP_CHKSUM <your_checksum_routine>
|
* #define LWIP_CHKSUM <your_checksum_routine>
|
||||||
*/
|
*/
|
||||||
@ -93,7 +93,8 @@ lwip_standard_chksum(void *dataptr, u16_t len)
|
|||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
/* accumulate remaining octet */
|
/* accumulate remaining octet */
|
||||||
acc += (*octetptr);
|
src = (*octetptr) << 8;
|
||||||
|
acc += src;
|
||||||
}
|
}
|
||||||
/* add deferred carry bits */
|
/* add deferred carry bits */
|
||||||
acc = (acc >> 16) + (acc & 0x0000ffffUL);
|
acc = (acc >> 16) + (acc & 0x0000ffffUL);
|
||||||
|
Loading…
Reference in New Issue
Block a user