diff mbox

appletalk/ddp.c: Neaten checksum function

Message ID 1257366373.18982.25.camel@Joe-Laptop.home
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Joe Perches Nov. 4, 2009, 8:26 p.m. UTC
atalk_sum_partial can now use the rol16 function in bitops.h

Signed-off-by: Joe Perches <joe@perches.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Nov. 8, 2009, 8:44 a.m. UTC | #1
From: Joe Perches <joe@perches.com>
Date: Wed, 04 Nov 2009 12:26:13 -0800

> atalk_sum_partial can now use the rol16 function in bitops.h
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }