diff options
| author | Russ White <russ@riw.us> | 2020-06-23 10:39:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-23 10:39:03 -0400 |
| commit | 2fb1599f65192d3b95ec7b0d17e1551c58a36518 (patch) | |
| tree | 5adec8e974eb2152aca3058db846476bf1943f69 /lib/prefix.c | |
| parent | 6d7824f29c4aad88009ac1dfe0491de31c01fcb3 (diff) | |
| parent | adeb067232387f42635a2fe1bfb58ea6311ffb67 (diff) | |
Merge pull request #6627 from qlyoung/clarify-prefix-bit-usage
lib: clarify usage of prefix_bit function
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; } |
