[PATCH 5/5 v2] checksum: Optimize first addition.
Joakim Tjernlund
Joakim.Tjernlund at transmode.se
Sun Apr 25 12:09:03 CEST 2010
The first add op. adds two 16 bit nums which cannot overflow
one 32 bits receiver so use plain addition instead.
---
v2 - adapt after bug fix.
lib/checksum.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/checksum.c b/lib/checksum.c
index 9e30bdc..d4ffdfd 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -59,7 +59,7 @@ ipsum_calc_block(u16 *buf, unsigned len, u16 sum)
acc_sum = sum;
if ((u32) buf & 2) { /* Align to 32-bit boundary */
- acc_sum = add32(acc_sum, *buf++);
+ acc_sum += *buf++; /* two 16 bit numbers cannot overflow 32 bits */
len =- 2;
}
rest = len & 1;
--
1.6.4.4
More information about the Bird-users
mailing list