diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-06-22 13:59:01 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2020-06-22 13:59:01 -0400 |
| commit | adeb067232387f42635a2fe1bfb58ea6311ffb67 (patch) | |
| tree | 94facbdefb24894637ddfd0c62dc0f881bc620ab /lib/prefix.c | |
| parent | a5e81e0367d3376f30589e429eef31db58aaf5d1 (diff) | |
lib: clarify usage of prefix_bit function
"prefixlen" is really a bit index
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/prefix.c')
| -rw-r--r-- | lib/prefix.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index 112630e9c8..0900100be3 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -75,10 +75,10 @@ bool is_mcast_mac(const struct ethaddr *mac) return false; } -unsigned int prefix_bit(const uint8_t *prefix, const uint16_t prefixlen) +unsigned int prefix_bit(const uint8_t *prefix, const uint16_t bit_index) { - unsigned int offset = prefixlen / 8; - unsigned int shift = 7 - (prefixlen % 8); + unsigned int offset = bit_index / 8; + unsigned int shift = 7 - (bit_index % 8); return (prefix[offset] >> shift) & 1; } |
