diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-10-07 16:29:42 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2009-10-07 16:29:42 +1100 |
commit | 1988e68eeeccee70503aa4fc502c783576bec76b (patch) | |
tree | cf6f3465c3dc378e4b48e0706d09ce868986d408 | |
parent | 2daebf96ebf0e18ccdd8aa61976047c3de4c2361 (diff) | |
parent | 428bc597508e482cdea17b11b7b08eabd6b924a6 (diff) |
Merge remote branch 'asm-generic/next'
-rw-r--r-- | lib/checksum.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/checksum.c b/lib/checksum.c index b2e2fd468461..097508732f34 100644 --- a/lib/checksum.c +++ b/lib/checksum.c @@ -37,7 +37,8 @@ #include <asm/byteorder.h> -static inline unsigned short from32to16(unsigned long x) +#ifndef do_csum +static inline unsigned short from32to16(unsigned int x) { /* add up 16-bit and 16-bit for 16+c bit */ x = (x & 0xffff) + (x >> 16); @@ -49,16 +50,16 @@ static inline unsigned short from32to16(unsigned long x) static unsigned int do_csum(const unsigned char *buff, int len) { int odd, count; - unsigned long result = 0; + unsigned int result = 0; if (len <= 0) goto out; odd = 1 & (unsigned long) buff; if (odd) { #ifdef __LITTLE_ENDIAN - result = *buff; -#else result += (*buff << 8); +#else + result = *buff; #endif len--; buff++; @@ -73,9 +74,9 @@ static unsigned int do_csum(const unsigned char *buff, int len) } count >>= 1; /* nr of 32-bit words.. */ if (count) { - unsigned long carry = 0; + unsigned int carry = 0; do { - unsigned long w = *(unsigned int *) buff; + unsigned int w = *(unsigned int *) buff; count--; buff += 4; result += carry; @@ -102,6 +103,7 @@ static unsigned int do_csum(const unsigned char *buff, int len) out: return result; } +#endif /* * This is a version of ip_compute_csum() optimized for IP headers, |