--- libelwix/src/crc.c 2013/01/17 10:05:35 1.1.1.1 +++ libelwix/src/crc.c 2015/06/25 00:36:48 1.3.20.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: crc.c,v 1.1.1.1 2013/01/17 10:05:35 misho Exp $ +* $Id: crc.c,v 1.3.20.1 2015/06/25 00:36:48 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2015 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -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;