[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1257366373.18982.25.camel@Joe-Laptop.home>
Date: Wed, 04 Nov 2009 12:26:13 -0800
From: Joe Perches <joe@...ches.com>
To: netdev <netdev@...r.kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
"David S. Miller" <davem@...emloft.net>
Subject: [PATCH] appletalk/ddp.c: Neaten checksum function
atalk_sum_partial can now use the rol16 function in bitops.h
Signed-off-by: Joe Perches <joe@...ches.com>
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index abe3801..e6903db 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -922,13 +922,8 @@ static unsigned long atalk_sum_partial(const unsigned char *data,
{
/* This ought to be unwrapped neatly. I'll trust gcc for now */
while (len--) {
- sum += *data;
- sum <<= 1;
- if (sum & 0x10000) {
- sum++;
- sum &= 0xffff;
- }
- data++;
+ sum += *data++;
+ sum = rol16(sum, 1);
}
return sum;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists