FreeBSD/sys/dev/cadence/if_cgem.c
/* cgem_mac_hash():  map 48-bit address to a 6-bit hash.
 * The 6-bit hash corresponds to a bit in a 64-bit hash
 * register.  Setting that bit in the hash register enables
 * reception of all frames with a destination address that hashes
 * to that 6-bit value.
 *
 * The hash function is described in sec. 16.2.3 in the Zynq-7000 Tech
 * Reference Manual.  Bits 0-5 in the hash are the exclusive-or of
 * every sixth bit in the destination address.
 */
map 48-bit address to a 6-bit hash.
The 6-bit hash corresponds to a bit in a 64-bit hash
register.  Setting that bit in the hash register enables
reception of all frames with a destination address that hashes
to that 6-bit value.

The hash function is described in sec. 16.2.3 in the Zynq-7000 Tech
Reference Manual.  Bits 0-5 in the hash are the exclusive-or of
every sixth bit in the destination address.
map 48 - bit address to a 6 - bit hash . The 6 - bit hash corresponds to a bit in a 64 - bit hash register . Setting that bit in the hash register enables reception of all frames with a destination address that hashes to that 6 - bit value . The hash function is described in sec . 16 . 2 . 3 in the Zynq - 7000 Tech Reference Manual . Bits 0 - 5 in the hash are the exclusive - or of every sixth bit in the destination address .
static int
cgem_mac_hash(u_char eaddr[])
{
	int hash;
	int i, j;
	hash = 0;
	for (i = 0; i < 6; i++)
		for (j = i; j < 48; j += 6)
			if ((eaddr[j >> 3] & (1 << (j & 7))) != 0)
				hash ^= (1 << i);
	return hash;
}
static int cgem_mac_hash ( u_char eaddr [ ] ) { int hash ; int i , j ; hash = 0 ; for ( i = 0 ; i < 6 ; i ++ ) for ( j = i ; j < 48 ; j += 6 ) if ( ( eaddr [ j >> 3 ] & ( 1 << ( j & 7 ) ) ) != 0 ) hash ^= ( 1 << i ) ; return hash ; }
cgem_mac_hash():  map 48-bit address to a 6-bit hash.
cgem_mac_hash () : map 48 - bit address to a 6 - bit hash .