From 6a441bfb46337ed6b59abed56dad35d94802282c Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 20 Mar 2008 19:54:59 +0000 Subject: Cosmetics, coding style fixes (trivial). Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3180 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/libpayload/libc/ipchecksum.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'payloads/libpayload/libc/ipchecksum.c') diff --git a/payloads/libpayload/libc/ipchecksum.c b/payloads/libpayload/libc/ipchecksum.c index caba6aaf34..4f712068e5 100644 --- a/payloads/libpayload/libc/ipchecksum.c +++ b/payloads/libpayload/libc/ipchecksum.c @@ -1,5 +1,7 @@ /* - * This file is part of the libpayload project + * This file is part of the libpayload project. + * + * It has orginally been taken from the FreeBSD project. * * Copyright (c) 2001 Charles Mott * All rights reserved. @@ -30,20 +32,20 @@ unsigned short ipchksum(const unsigned short *ptr, unsigned long nbytes) { - int sum, oddbyte; + int sum, oddbyte; - sum = 0; - while (nbytes > 1) { - sum += *ptr++; - nbytes -= 2; - } - if (nbytes == 1) { - oddbyte = 0; - ((u8 *) &oddbyte)[0] = *(u8 *)ptr; - ((u8 *) &oddbyte)[1] = 0; - sum += oddbyte; - } - sum = (sum >> 16) + (sum & 0xffff); - sum += (sum >> 16); - return (~sum); + sum = 0; + while (nbytes > 1) { + sum += *ptr++; + nbytes -= 2; + } + if (nbytes == 1) { + oddbyte = 0; + ((u8 *) & oddbyte)[0] = *(u8 *) ptr; + ((u8 *) & oddbyte)[1] = 0; + sum += oddbyte; + } + sum = (sum >> 16) + (sum & 0xffff); + sum += (sum >> 16); + return (~sum); } -- cgit v1.2.3