beautypg.com

An194 – Cirrus Logic AN194 User Manual

Page 4

background image

AN194

4

AN194REV1

}

return HashIndex;

} /* end of CalculateHashIndex() */

void updatecrc( int bit )

{

int j;

/* >> 1 the crc, use high bit (now CRC[32]) as control bit */

for (j = 32; j > 0; j--) CRC[j] = CRC[j - 1];

CRC[0] = 0;

/* if bit ^ (control bit) = 1, set CRC = CRC ^ polynomial */

if (bit ^ CRC[32])

{

for ( j = 0; j < 32; j++)

{

CRC[j] ^= crc_poly[j];

}

}

}