MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_dir

Function get_dir

dpdk/lib/rib/rte_rib6.c:78–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static inline int
79get_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
101static inline struct rte_rib6_node *
102get_nxt_node(struct rte_rib6_node *node,

Callers 2

get_nxt_nodeFunction · 0.85
rte_rib6_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected