Make last commit bde-compliant:

- correct indentation
	- change data types for consistency with the rest of ping.c
	- create new variable separate from "answer" for clarity
This commit is contained in:
Pierre Beyssac 1999-11-18 10:20:45 +00:00
parent 4add59312e
commit 09333e7833
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53369

View File

@ -930,9 +930,10 @@ in_cksum(addr, len)
register u_short *w = addr;
register int sum = 0;
union {
u_int16_t us;
u_int8_t uc[2];
} answer;
u_short us;
u_char uc[2];
} last;
u_short answer;
/*
* Our algorithm is simple, using a 32 bit accumulator (sum), we add
@ -946,16 +947,16 @@ in_cksum(addr, len)
/* mop up an odd byte, if necessary */
if (nleft == 1) {
answer.uc[0] = *(u_char *)w;
answer.uc[1] = 0;
sum += answer.us;
last.uc[0] = *(u_char *)w;
last.uc[1] = 0;
sum += last.us;
}
/* add back carry outs from top 16 bits to low 16 bits */
sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
sum += (sum >> 16); /* add carry */
answer.us = ~sum; /* truncate to 16 bits */
return(answer.us);
answer = ~sum; /* truncate to 16 bits */
return(answer);
}
/*