From: Joe Perches Date: Wed, 4 Nov 2009 10:26:13 +0000 (+0000) Subject: appletalk/ddp.c: Neaten checksum function X-Git-Tag: v2.6.33-rc1~388^2~465 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=f7a3a1d8affe563846fc17f0e7c0cc1500190c57;p=~shefty%2Frdma-dev.git appletalk/ddp.c: Neaten checksum function atalk_sum_partial can now use the rol16 function in bitops.h Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 31fca64d17a..b631cc73454 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; }