Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx> --- usr/be_byteshift.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/usr/be_byteshift.h b/usr/be_byteshift.h index 5c6a619..82b7da6 100644 --- a/usr/be_byteshift.h +++ b/usr/be_byteshift.h @@ -40,6 +40,11 @@ static inline uint16_t get_unaligned_be16(const void *p) return __get_unaligned_be16((const uint8_t *)p); } +static inline uint32_t get_unaligned_be24(const uint8_t *p) +{ + return p[0] << 16 | p[1] << 8 | p[2]; +} + static inline uint32_t get_unaligned_be32(const void *p) { return __get_unaligned_be32((const uint8_t *)p); @@ -55,6 +60,13 @@ static inline void put_unaligned_be16(uint16_t val, void *p) __put_unaligned_be16(val, p); } +static inline void put_unaligned_be24(uint32_t val, void *p) +{ + ((uint8_t *)p)[0] = (val >> 16) & 0xff; + ((uint8_t *)p)[1] = (val >> 8) & 0xff; + ((uint8_t *)p)[2] = val & 0xff; +} + static inline void put_unaligned_be32(uint32_t val, void *p) { __put_unaligned_be32(val, p); -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html