| 694 | } |
| 695 | |
| 696 | static inline uint8_t |
| 697 | read_unaligned_byte(uint8_t *ptr, unsigned int offset) |
| 698 | { |
| 699 | uint8_t ret = 0; |
| 700 | |
| 701 | ret = ptr[offset / CHAR_BIT]; |
| 702 | if (offset % CHAR_BIT) { |
| 703 | ret <<= (offset % CHAR_BIT); |
| 704 | ret |= ptr[(offset / CHAR_BIT) + 1] >> |
| 705 | (CHAR_BIT - (offset % CHAR_BIT)); |
| 706 | } |
| 707 | |
| 708 | return ret; |
| 709 | } |
| 710 | |
| 711 | static inline uint32_t |
| 712 | read_unaligned_bits(uint8_t *ptr, int len, int offset) |
no outgoing calls
no test coverage detected