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

Function read_unaligned_bits

dpdk/lib/hash/rte_thash.c:711–731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711static inline uint32_t
712read_unaligned_bits(uint8_t *ptr, int len, int offset)
713{
714 uint32_t ret = 0;
715 int shift;
716
717 len = RTE_MAX(len, 0);
718 len = RTE_MIN(len, (int)(sizeof(uint32_t) * CHAR_BIT));
719
720 while (len > 0) {
721 ret <<= CHAR_BIT;
722
723 ret |= read_unaligned_byte(ptr, offset);
724 offset += CHAR_BIT;
725 len -= CHAR_BIT;
726 }
727
728 shift = (len == 0) ? 0 :
729 (CHAR_BIT - ((len + CHAR_BIT) % CHAR_BIT));
730 return ret >> shift;
731}
732
733/* returns mask for len bits with given offset inside byte */
734static inline uint8_t

Callers 1

rte_thash_adjust_tupleFunction · 0.85

Calls 1

read_unaligned_byteFunction · 0.85

Tested by

no test coverage detected