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

Function depth_to_mask

dpdk/lib/lpm/rte_lpm.c:85–94  ·  view source on GitHub ↗

* Converts a given depth value to its corresponding mask value. * * depth (IN) : range = 1 - 32 * mask (OUT) : 32bit mask */

Source from the content-addressed store, hash-verified

83 * mask (OUT) : 32bit mask
84 */
85static uint32_t __attribute__((pure))
86depth_to_mask(uint8_t depth)
87{
88 VERIFY_DEPTH(depth);
89
90 /* To calculate a mask start with a 1 on the left hand side and right
91 * shift while populating the left hand side with 1's
92 */
93 return (int)0x80000000 >> (depth - 1);
94}
95
96/*
97 * Converts given depth value to its corresponding range value.

Callers 4

rte_lpm_addFunction · 0.70
rte_lpm_is_rule_presentFunction · 0.70
find_previous_ruleFunction · 0.70
rte_lpm_deleteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected