| 151 | #endif /* not _KERNEL */ |
| 152 | |
| 153 | void |
| 154 | DifferentialChecksum(u_short * cksum, void *newp, void *oldp, int n) |
| 155 | { |
| 156 | int i; |
| 157 | int accumulate; |
| 158 | u_short *new = newp; |
| 159 | u_short *old = oldp; |
| 160 | |
| 161 | accumulate = *cksum; |
| 162 | for (i = 0; i < n; i++) { |
| 163 | accumulate -= *new++; |
| 164 | accumulate += *old++; |
| 165 | } |
| 166 | |
| 167 | if (accumulate < 0) { |
| 168 | accumulate = -accumulate; |
| 169 | accumulate = (accumulate >> 16) + (accumulate & 0xffff); |
| 170 | accumulate += accumulate >> 16; |
| 171 | *cksum = (u_short) ~ accumulate; |
| 172 | } else { |
| 173 | accumulate = (accumulate >> 16) + (accumulate & 0xffff); |
| 174 | accumulate += accumulate >> 16; |
| 175 | *cksum = (u_short) accumulate; |
| 176 | } |
| 177 | } |
no outgoing calls
no test coverage detected