Revision 5fafdf24 slirp/cksum.c
b/slirp/cksum.c | ||
---|---|---|
41 | 41 |
* |
42 | 42 |
* This routine is very heavily used in the network |
43 | 43 |
* code and should be modified for each CPU to be as fast as possible. |
44 |
*
|
|
44 |
* |
|
45 | 45 |
* XXX Since we will never span more than 1 mbuf, we can optimise this |
46 | 46 |
*/ |
47 | 47 |
|
... | ... | |
63 | 63 |
u_int16_t s[2]; |
64 | 64 |
u_int32_t l; |
65 | 65 |
} l_util; |
66 |
|
|
66 |
|
|
67 | 67 |
if (m->m_len == 0) |
68 | 68 |
goto cont; |
69 | 69 |
w = mtod(m, u_int16_t *); |
70 |
|
|
70 |
|
|
71 | 71 |
mlen = m->m_len; |
72 |
|
|
72 |
|
|
73 | 73 |
if (len < mlen) |
74 | 74 |
mlen = len; |
75 | 75 |
len -= mlen; |
... | ... | |
107 | 107 |
while ((mlen -= 2) >= 0) { |
108 | 108 |
sum += *w++; |
109 | 109 |
} |
110 |
|
|
110 |
|
|
111 | 111 |
if (byte_swapped) { |
112 | 112 |
REDUCE; |
113 | 113 |
sum <<= 8; |
... | ... | |
117 | 117 |
sum += s_util.s; |
118 | 118 |
mlen = 0; |
119 | 119 |
} else |
120 |
|
|
120 |
|
|
121 | 121 |
mlen = -1; |
122 | 122 |
} else if (mlen == -1) |
123 | 123 |
s_util.c[0] = *(u_int8_t *)w; |
124 |
|
|
124 |
|
|
125 | 125 |
cont: |
126 | 126 |
#ifdef DEBUG |
127 | 127 |
if (len) { |
Also available in: Unified diff