Sample hash table code
400
NS9750 Hardware Reference
* Function: int calculate_hash_bit (BYTE *mca)
*
* Description:
* This routine calculates which bit in the CRC hash table needs
* to be set for the MERCURY to recognize incoming packets with
* the MCA passed to us.
*
* Parameters:
*
* mca pointer to multi-cast address
*
* Return Values:
*
* bit position to set in hash table
*
*/
#define POLYNOMIAL 0x4c11db6L
static int calculate_hash_bit (BYTE *mca)
{
WORD32 crc;
WORD16 *mcap, bp, bx;
int result, index, mca_word, bit_index;
BYTE lsb;
WORD16 copy_mca[3]
memcpy (copy_mca,mca,sizeof(copy_mca));
for (index = 0; index < 3; index++)
{
copy_mca [index] = SWAP16 (copy_mca [index]);
}
mcap = copy_mca;
crc = 0xffffffffL;
for (mca_word = 0; mca_word < 3; mca_word++)
{
bp = *mcap;