|
From: | Timmy Brolin |
Subject: | Re: [lwip-users] lwip_standard_chksum() |
Date: | Sat, 10 Dec 2005 21:12:23 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
Leon Woestenberg wrote:
Hello Curt,first look through the code, my brain triggered on something in memory that seemed to have survived time despite wear and beer: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.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++;
Where? I can't see a 16bit fetch there. Timmy Brolin
[Prev in Thread] | Current Thread | [Next in Thread] |