Netdev List
 help / color / mirror / Atom feed
* [PATCH] appletalk/ddp.c: Neaten checksum function
@ 2009-11-04 20:26 Joe Perches
  2009-11-08  8:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2009-11-04 20:26 UTC (permalink / raw)
  To: netdev; +Cc: Arnaldo Carvalho de Melo, David S. Miller

atalk_sum_partial can now use the rol16 function in bitops.h

Signed-off-by: Joe Perches <joe@perches.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;
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-08  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 20:26 [PATCH] appletalk/ddp.c: Neaten checksum function Joe Perches
2009-11-08  8:44 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox