* Copyright (c) 1982 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
* @(#)pup_cksum.c 6.3 (Berkeley) %G%
* Checksum routine for PUP-I Protocol family (VAX Version).
register int sum
= 0; /* known to be r8 */
* Each trip around loop adds in
* words from one mbuf segment.
* There is a byte left from the last segment;
* add it into the checksum.
sum
+= *(u_char
*)w
<< 8;
w
= (u_short
*)((char *)w
+ 1);
while ((mlen
-= 2) >= 0) {
asm("addw2 (r9)+,r8; rotl $1,r8,r8;");
* Locate the next block with some data.
* If there is a word split across a boundary we
* will wrap to the top with mlen == -1 and
* then add it in shifted appropriately.
printf("pup_cksum: out of data\n");