<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2>I should have read on;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2>it looks like the ptr is being
incremented</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2>u_short *tmp;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2>tmp = <FONT face="Times New Roman" color=#000000
size=3>(u_short *) data;</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><SPAN
class=448183601-20022004><FONT face="Times New Roman" color=#000000 size=3>sum
+= *tmp;</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><SPAN
class=448183601-20022004><FONT face="Times New Roman" color=#000000 size=3>data
+= sizeof(u_short);</FONT></SPAN></SPAN></DIV></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=448183601-20022004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><FONT face=Arial color=#0000ff
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Damian Slee <BR><B>Sent:</B> Friday, 20
February 2004 9:35 AM<BR><B>To:</B> Brett.Abbott@digital-telemetry.com; Ethernut
User Chat (English)<BR><B>Subject:</B> RE: [En-Nut-Discussion] eboot, a tricky
bit.<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2>I'm pretty sure its incrementing the contents of memory,
not the ptr. the above/below code would help to double
check.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2>u_short *tmp;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2>tmp = <FONT face="Times New Roman" color=#000000
size=3>(u_short *) data;</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004>*tmp++; // or
(*tmp)++ if it reads better</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=051393101-20022004><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Brett Abbott
[mailto:Brett.Abbott@digital-telemetry.com] <BR><B>Sent:</B> Friday, 20 February
2004 9:22 AM<BR><B>To:</B> en-nut-discussion@egnite.de<BR><B>Subject:</B>
[En-Nut-Discussion] eboot, a tricky bit.<BR></FONT><BR></DIV>
<DIV></DIV>Hi<BR><BR>Ive almost completed the port to ICC of eboot but have
found a segment of code that has stumped my self taught C programming
skills. Could I ask if someone could advise us of the appropriate ICC
equivalent?<BR><BR>In particular, the line Im having trouble compiling is "sum
+= *((u_short *) data)++;"<BR><BR>Many Thanks, Any help
appreciated.<BR>Brett<BR><BR>from eboot\ip.c:<BR><BR>/*!<BR> * \brief
Calculate the IP checksum over a block of data.<BR> *<BR> * \param
data Pointer to the data block.<BR> * \param size Size of the data
block.<BR> *<BR> * \return The checksum in network byte
order.<BR> */<BR>static u_short IpChkSum(const void *data, u_short
size)<BR>{<BR> register u_long sum =
0;<BR><BR> for (;;)
{<BR> if (size <
2)<BR>
break;<BR> sum += *((u_short *)
data)++;<BR> size -=
2;<BR> }<BR> if
(size)<BR> sum += *(u_char *)
data;<BR><BR> while ((size = (u_short) (sum >> 16)) !=
0)<BR> sum = (u_short) sum +
size;<BR><BR> return (u_short) sum ^ 0xFFFF;<BR>}<BR><BR><PRE class=moz-signature cols="72">--
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: <A class=moz-txt-link-abbreviated href="mailto:Brett.Abbott@digital-telemetry.com">Brett.Abbott@digital-telemetry.com</A>
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860 Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------
</PRE></BODY></HTML>