src/dpdk/lib/librte_lpm/rte_lpm6.c
static inline void
ip6_mask_addr(uint8_t *ip, uint8_t depth)
{
	int16_t part_depth, mask;
	int i;

	part_depth = depth;

	for (i = 0; i < RTE_LPM6_IPV6_ADDR_SIZE; i++) {
		if (part_depth < BYTE_SIZE && part_depth >= 0) {
			mask = (uint16_t)(~(UINT8_MAX >> part_depth));
			ip[i] = (uint8_t)(ip[i] & mask);
		} else if (part_depth < 0)
			ip[i] = 0;

		part_depth -= BYTE_SIZE;
	}
}
/*
 * Takes an array of uint8_t (IPv6 address) and masks it using the depth.
 * It leaves untouched one bit per unit in the depth variable
 * and set the rest to 0.
 */
Takes an array of uint8_t (IPv6 address) and masks it using the depth.
It leaves untouched one bit per unit in the depth variable
and set the rest to 0.
Takes an array of uint8_t ( IPv6 address ) and masks it using the depth . It leaves untouched one bit per unit in the depth variable and set the rest to 0 .
static inline void
ip6_mask_addr(uint8_t *ip, uint8_t depth)
{
	int16_t part_depth, mask;
	int i;
	part_depth = depth;
	for (i = 0; i < RTE_LPM6_IPV6_ADDR_SIZE; i++) {
		if (part_depth < BYTE_SIZE && part_depth >= 0) {
			mask = (uint16_t)(~(UINT8_MAX >> part_depth));
			ip[i] = (uint8_t)(ip[i] & mask);
		} else if (part_depth < 0)
			ip[i] = 0;
		part_depth -= BYTE_SIZE;
	}
}
static inline void ip6_mask_addr ( uint8_t * ip , uint8_t depth ) { int16_t part_depth , mask ; int i ; part_depth = depth ; for ( i = 0 ; i < RTE_LPM6_IPV6_ADDR_SIZE ; i ++ ) { if ( part_depth < BYTE_SIZE && part_depth >= 0 ) { mask = ( uint16_t ) ( ~ ( UINT8_MAX >> part_depth ) ) ; ip [ i ] = ( uint8_t ) ( ip [ i ] & mask ) ; } else if ( part_depth < 0 ) ip [ i ] = 0 ; part_depth -= BYTE_SIZE ; } }
Takes an array of uint8_t (IPv6 address) and masks it using the depth.
Takes an array of uint8_t ( IPv6 address ) and masks it using the depth .