| 76 | } |
| 77 | |
| 78 | static inline int |
| 79 | get_dir(const uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE], uint8_t depth) |
| 80 | { |
| 81 | uint8_t index, msk; |
| 82 | |
| 83 | /* |
| 84 | * depth & 127 clamps depth to values that will not |
| 85 | * read off the end of ip. |
| 86 | * depth is the number of bits deep into ip to traverse, and |
| 87 | * is incremented in blocks of 8 (1 byte). This means the last |
| 88 | * 3 bits are irrelevant to what the index of ip should be. |
| 89 | */ |
| 90 | index = (depth & INT8_MAX) / CHAR_BIT; |
| 91 | |
| 92 | /* |
| 93 | * msk is the bitmask used to extract the bit used to decide the |
| 94 | * direction of the next step of the binary search. |
| 95 | */ |
| 96 | msk = 1 << (7 - (depth & 7)); |
| 97 | |
| 98 | return (ip[index] & msk) != 0; |
| 99 | } |
| 100 | |
| 101 | static inline struct rte_rib6_node * |
| 102 | get_nxt_node(struct rte_rib6_node *node, |
no outgoing calls
no test coverage detected