<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
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>