提交 f7a3a1d8 编写于 作者: J Joe Perches 提交者: David S. Miller

appletalk/ddp.c: Neaten checksum function

atalk_sum_partial can now use the rol16 function in bitops.h
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fd5c0027
...@@ -922,13 +922,8 @@ static unsigned long atalk_sum_partial(const unsigned char *data, ...@@ -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 */ /* This ought to be unwrapped neatly. I'll trust gcc for now */
while (len--) { while (len--) {
sum += *data; sum += *data++;
sum <<= 1; sum = rol16(sum, 1);
if (sum & 0x10000) {
sum++;
sum &= 0xffff;
}
data++;
} }
return sum; return sum;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册