Add helper to avoid possible unaligned memory access when handling uint16 value using big-endian representation. --- src/shared/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/util.h b/src/shared/util.h index 29f6f6b..e315f84 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -106,6 +106,11 @@ static inline uint16_t get_le16(const void *ptr) return le16_to_cpu(get_unaligned((const uint16_t *) ptr)); } +static inline uint16_t get_be16(const void *ptr) +{ + return be16_to_cpu(get_unaligned((const uint16_t *) ptr)); +} + static inline uint32_t get_le32(const void *ptr) { return le32_to_cpu(get_unaligned((const uint32_t *) ptr)); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html