From d8ea722e8aa86049f99892daa96b3799284a1306 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Fri, 3 Jan 2020 11:11:22 +0900 Subject: [PATCH] Fix wrong endian conversion macro Change-Id: Id7130b79739cd8ba6f9271f28db18d7b6a0baa79 Signed-off-by: Semun Lee --- include/transport/mtp_descs_strings.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/transport/mtp_descs_strings.h b/include/transport/mtp_descs_strings.h index 26cf650..9e340f5 100644 --- a/include/transport/mtp_descs_strings.h +++ b/include/transport/mtp_descs_strings.h @@ -28,10 +28,15 @@ enum functionfs_flags { }; #endif +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) +#else #define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) #define cpu_to_le32(x) \ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) +#endif #define le32_to_cpu(x) le32toh(x) #define le16_to_cpu(x) le16toh(x) -- 2.7.4