lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip_standard_chksum()


From: Leon Woestenberg
Subject: Re: [lwip-users] lwip_standard_chksum()
Date: Fri, 09 Dec 2005 13:35:37 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Hello Curt,

first look through the code, my brain triggered on something in memory that seemed to have survived time despite wear and beer:

lwip_standard_chksum2(void *dataptr, int len)
{
 u8_t *pb = dataptr;
 u16_t *ps, t = 0;
 u32_t sum = 0;
 int odd = ((u32_t)pb & 1);

 /* Get aligned to u16_t */
 if (odd && len > 0) {
   ((u8_t *)&t)[1] = *pb++;
This fetches a 16-bit word, possible on a non-16 bit aligned address. Some CPU's will puke at this point and stop execution. I wish I could name a few CPUs with 100% certainty but I cannot now, though I am sure have come across this on some 16 and 32-bit platforms.

What should be done here is fetch a 8-bit number on a 8-bit aligned address (which is always the case :-)).

Regards,

Leon.






reply via email to

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