version 1.4.2.3, 2012/07/04 14:46:33
|
version 1.4.2.4, 2012/07/04 14:52:57
|
Line 141 crcCalc(u_char * __restrict psBuf, u_int bufLen, u_cha
|
Line 141 crcCalc(u_char * __restrict psBuf, u_int bufLen, u_cha
|
u_int poly, crchibit, crc; |
u_int poly, crchibit, crc; |
register u_int i, j, b, ch; |
register u_int i, j, b, ch; |
|
|
if (!psBuf) { | assert(psBuf); |
crc_SetErr(EINVAL, "Invalid parameters!"); | |
return -1; | |
} | |
|
|
switch (crcBits) { |
switch (crcBits) { |
case 1: |
case 1: |
Line 240 crcIP(u_char * __restrict buf, int bufLen)
|
Line 237 crcIP(u_char * __restrict buf, int bufLen)
|
register u_int sum; |
register u_int sum; |
u_short last = 0, *nBuf = (u_short*) buf; |
u_short last = 0, *nBuf = (u_short*) buf; |
|
|
if (!buf) { | assert(buf); |
crc_SetErr(EINVAL, "Invalid parameters!"); | |
return -1; | |
} | |
|
|
for (sum = 0; bufLen && bufLen > 1; bufLen -= 2) |
for (sum = 0; bufLen && bufLen > 1; bufLen -= 2) |
sum += *nBuf++; |
sum += *nBuf++; |
Line 272 crcFletcher16(u_short * __restrict nBuf, int bufLen)
|
Line 266 crcFletcher16(u_short * __restrict nBuf, int bufLen)
|
register u_short s1, s2; |
register u_short s1, s2; |
register u_int clen; |
register u_int clen; |
|
|
if (!nBuf) { | assert(nBuf); |
crc_SetErr(EINVAL, "Invalid parameters!"); | |
return -1; | |
} | |
|
|
s1 = s2 = 0xFF; |
s1 = s2 = 0xFF; |
while (bufLen) { |
while (bufLen) { |
Line 307 crcFletcher(u_short * __restrict nBuf, int bufLen)
|
Line 298 crcFletcher(u_short * __restrict nBuf, int bufLen)
|
{ |
{ |
register u_int s1, s2, clen; |
register u_int s1, s2, clen; |
|
|
if (!nBuf) { | assert(nBuf); |
crc_SetErr(EINVAL, "Invalid parameters!"); | |
return -1; | |
} | |
|
|
s1 = s2 = 0xFFFF; |
s1 = s2 = 0xFFFF; |
while (bufLen) { |
while (bufLen) { |
Line 342 crcAdler(u_char * __restrict psBuf, int bufLen)
|
Line 330 crcAdler(u_char * __restrict psBuf, int bufLen)
|
{ |
{ |
register u_int s1, s2, clen; |
register u_int s1, s2, clen; |
|
|
if (!psBuf) { | assert(psBuf); |
crc_SetErr(EINVAL, "Invalid parameters!"); | |
return -1; | |
} | |
|
|
s1 = 1L; |
s1 = 1L; |
s2 ^= s2; |
s2 ^= s2; |