MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / HashIndex

Function HashIndex

src/dolphin/src/eth/eth.c:898–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896}
897
898static u16 HashIndex(const u8* address) {
899 u32 crc;
900 u16 index;
901 u32 msb;
902 u8 byte;
903 s32 byteLen;
904 s32 bit;
905 s32 shift;
906
907 crc = 0xFFFFFFFF;
908 index = 0;
909
910 for (byteLen = 0; byteLen < 6; byteLen++, address++) {
911 byte = *address;
912 bit = 0;
913 for (bit = 0; bit < 8; bit++, byte >>= 1) {
914 msb = (crc >> 31) & 1;
915 crc = crc << 1;
916
917 if (msb ^ (byte & 1)) {
918 crc ^= 0x04C11DB6;
919 crc |= 1;
920 }
921 }
922 }
923
924 bit = 31;
925 for (shift = 5; shift >= 0; shift--, bit--) {
926 index |= ((crc >> bit) & 1) << shift;
927 }
928
929 return index;
930}
931
932void ETHAddMulticastAddress(const u8* macaddr) {
933 BOOL disabled;

Callers 1

ETHAddMulticastAddressFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected