summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2022-03-09 14:51:27 +0100
committerAlexander Larsson <alexl@redhat.com>2022-03-09 14:51:27 +0100
commit1dbba36a39294588cd71df1907d2307714f6cabc (patch)
treef819ccf394c9cf670e0bea386fb10004d8842756
parent13f9c89ced6ffaeb1faf485152e27e1f40d234cd (diff)
downloadvSomeIP-1dbba36a39294588cd71df1907d2307714f6cabc.tar.gz
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
-rw-r--r--implementation/utility/include/byteorder.hpp6
1 files changed, 4 insertions, 2 deletions
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