diff options
author | naddy <naddy@FreeBSD.org> | 2004-06-09 14:34:04 +0000 |
---|---|---|
committer | naddy <naddy@FreeBSD.org> | 2004-06-09 14:34:04 +0000 |
commit | 03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1 (patch) | |
tree | 63c1a8adb963adf2b159557569195cbc8c219d33 /sys/dev/usb/if_cue.c | |
parent | d57aeb149e038b4931b3859597fe80119588eebc (diff) | |
download | FreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.zip FreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.tar.gz |
Replace handrolled CRC calculation with ether_crc32_[lb]e().
Diffstat (limited to 'sys/dev/usb/if_cue.c')
-rw-r--r-- | sys/dev/usb/if_cue.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 3ea9596..d7f5f6b 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -323,23 +323,15 @@ cue_getmac(struct cue_softc *sc, void *buf) return(0); } -#define CUE_POLY 0xEDB88320 #define CUE_BITS 9 Static uint32_t cue_mchash(const uint8_t *addr) { uint32_t crc; - int idx, bit; - uint8_t data; /* Compute CRC for the address value. */ - crc = 0xFFFFFFFF; /* initial value */ - - for (idx = 0; idx < 6; idx++) { - for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) - crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CUE_POLY : 0); - } + crc = ether_crc32_le(addr, ETHER_ADDR_LEN); return (crc & ((1 << CUE_BITS) - 1)); } |