returns mask for len bits with given offset inside byte */
| 732 | |
| 733 | /* returns mask for len bits with given offset inside byte */ |
| 734 | static inline uint8_t |
| 735 | get_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 | |
| 747 | static inline void |
| 748 | write_unaligned_byte(uint8_t *ptr, unsigned int len, |
no outgoing calls
no test coverage detected