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

Function get_bits_mask

dpdk/lib/hash/rte_thash.c:734–745  ·  view source on GitHub ↗

returns mask for len bits with given offset inside byte */

Source from the content-addressed store, hash-verified

732
733/* returns mask for len bits with given offset inside byte */
734static inline uint8_t
735get_bits_mask(unsigned int len, unsigned int offset)
736{
737 unsigned int last_bit;
738
739 offset %= CHAR_BIT;
740 /* last bit within byte */
741 last_bit = RTE_MIN((unsigned int)CHAR_BIT, offset + len);
742
743 return ((1 << (CHAR_BIT - offset)) - 1) ^
744 ((1 << (CHAR_BIT - last_bit)) - 1);
745}
746
747static inline void
748write_unaligned_byte(uint8_t *ptr, unsigned int len,

Callers 1

write_unaligned_byteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected