lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 22 Oct 2007 12:36:19 -0700 From: Joe Perches <joe@...ches.com> To: Arnaldo Carvalho de Melo <acme@...stprotocols.net> Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net> Subject: [PATCH] - trivial - Improve appletalk checksum calculation It's a bit after 2.6.1 now... Removes unnecessary if, uses 16 bit rotate left. Performance improves ~30% Signed-off-by: Joe Perches <joe@...ches.com> diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 7c0b515..1c50f4c 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -925,15 +925,9 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg) static unsigned long atalk_sum_partial(const unsigned char *data, int len, unsigned long sum) { - /* 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 = ((sum & 0x8000)>>15) | ((sum & 0x7fff)<<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