From 1dbba36a39294588cd71df1907d2307714f6cabc Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 9 Mar 2022 14:51:27 +0100 Subject: Fix big endian support in byteorder.hpp This adds VSOMEIP_WORDS_TO_LONG and removes unmatched parenthesis in VSOMEIP_LONG_WORD0 and VSOMEIP_LONG_WORD1 --- implementation/utility/include/byteorder.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'implementation') diff --git a/implementation/utility/include/byteorder.hpp b/implementation/utility/include/byteorder.hpp index ea2dc38..ad7f752 100644 --- a/implementation/utility/include/byteorder.hpp +++ b/implementation/utility/include/byteorder.hpp @@ -38,6 +38,8 @@ #define VSOMEIP_BYTES_TO_WORD(x0, x1) (uint16_t((x1) << 8 | (x0))) #define VSOMEIP_BYTES_TO_LONG(x0, x1, x2, x3) (uint32_t((x3) << 24 | (x2) << 16 | (x1) << 8 | (x0))) +#define VSOMEIP_WORDS_TO_LONG(x0, x1) (uint32_t((x1) << 16 | (x0))) + #define VSOMEIP_WORD_BYTE0(x) (uint8_t((x) >> 8)) #define VSOMEIP_WORD_BYTE1(x) (uint8_t((x) & 0xFF)) @@ -46,8 +48,8 @@ #define VSOMEIP_LONG_BYTE2(x) (uint8_t(((x) >> 8) & 0xFF)) #define VSOMEIP_LONG_BYTE3(x) (uint8_t((x) & 0xFF)) -#define VSOMEIP_LONG_WORD0(x) (uint16_t((((x) >> 16) & 0xFFFF)) -#define VSOMEIP_LONG_WORD1(x) (uint16_t(((x) & 0xFFFF)) +#define VSOMEIP_LONG_WORD0(x) (uint16_t(((x) >> 16) & 0xFFFF)) +#define VSOMEIP_LONG_WORD1(x) (uint16_t((x) & 0xFFFF)) #else -- cgit v1.2.1