--- libelwix/src/crc.c 2013/01/17 10:05:35 1.1 +++ libelwix/src/crc.c 2013/08/12 02:10:44 1.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: crc.c,v 1.1 2013/01/17 10:05:35 misho Exp $ +* $Id: crc.c,v 1.2 2013/08/12 02:10:44 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -78,9 +78,9 @@ const crcPoly_t crc_Poly[] = { inline u_int crcReflect(u_int crcNum, u_char crcBits) { - register u_int i, j, rev; + register u_int i, j = 1, rev = 0; - for (i = (u_int) 1 << (crcBits - 1), j = 1, rev ^= rev; i; i >>= 1, j <<= 1) + for (i = (u_int) 1 << (crcBits - 1); i; i >>= 1, j <<= 1) if (crcNum & i) rev |= j; return rev; @@ -287,12 +287,10 @@ crcFletcher(u_short * __restrict nBuf, int bufLen) inline u_int crcAdler(u_char * __restrict psBuf, int bufLen) { - register u_int s1, s2, clen; + register u_int s1 = 1, s2 = 0, clen; assert(psBuf); - s1 = 1L; - s2 ^= s2; while (bufLen) { clen = bufLen > MAX_ADLER_DIGEST ? MAX_ADLER_DIGEST : bufLen; bufLen -= clen;