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

Function get_bitshift

dpdk/lib/lpm/rte_lpm6.c:570–586  ·  view source on GitHub ↗

* Calculate index to the table based on the number and position * of the bytes being inspected in this step. */

Source from the content-addressed store, hash-verified

568 * of the bytes being inspected in this step.
569 */
570static uint32_t
571get_bitshift(const uint8_t *ip, uint8_t first_byte, uint8_t bytes)
572{
573 uint32_t entry_ind, i;
574 int8_t bitshift;
575
576 entry_ind = 0;
577 for (i = first_byte; i < (uint32_t)(first_byte + bytes); i++) {
578 bitshift = (int8_t)((bytes - i)*BYTE_SIZE);
579
580 if (bitshift < 0)
581 bitshift = 0;
582 entry_ind = entry_ind | ip[i-1] << bitshift;
583 }
584
585 return entry_ind;
586}
587
588/*
589 * Simulate adding a new route to the LPM counting number

Callers 2

simulate_add_stepFunction · 0.70
add_stepFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected