[LEDE-DEV] [PATCH] uqmi: Fix for big endian arch
Oskari Lemmela
oskari at lemmela.net
Sun Apr 1 07:22:35 PDT 2018
leXX_to_cpu function messes up get_next value in big endian arch.
Signed-off-by: Oskari Lemmelä <oskari at lemmela.net>
---
data/gen-code.pl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/data/gen-code.pl b/data/gen-code.pl
index f45d28a..cf46b67 100755
--- a/data/gen-code.pl
+++ b/data/gen-code.pl
@@ -13,12 +13,12 @@ my $varsize_field;
my %tlv_get = (
gint8 => "*(int8_t *) get_next(1)",
guint8 => "*(uint8_t *) get_next(1)",
- gint16 => "le16_to_cpu(*(uint16_t *) get_next(2))",
- guint16 => "le16_to_cpu(*(uint16_t *) get_next(2))",
- gint32 => "le32_to_cpu(*(uint32_t *) get_next(4))",
- guint32 => "le32_to_cpu(*(uint32_t *) get_next(4))",
- gint64 => "le64_to_cpu(*(uint64_t *) get_next(8))",
- guint64 => "le64_to_cpu(*(uint64_t *) get_next(8))",
+ gint16 => "({ int16_t value = *(int16_t *) get_next(2); int16_t _val = le16_to_cpu(value); _val;})",
+ guint16 => "({ uint16_t value = *(uint16_t *) get_next(2); uint16_t _val = le16_to_cpu(value); _val;})",
+ gint32 => "({ int32_t value = *(int32_t *) get_next(4); int32_t _val = le32_to_cpu(value); _val;})",
+ guint32 => "({ uint32_t value = *(uint32_t *) get_next(4); uint32_t _val = le32_to_cpu(value); _val;})",
+ gint64 => "({ int64_t value = *(int64_t *) get_next(8); int64_t _val = le64_to_cpu(value); _val;})",
+ guint64 => "({ uint64_t value = *(uint64_t *) get_next(8); uint64_t _val = le64_to_cpu(value); _val;})",
gfloat => "({ uint32_t data = le32_to_cpu(*(uint32_t *) get_next(4)); float _val; memcpy(&_val, &data, sizeof(_val)); _val; })"
);
--
2.7.4
More information about the Lede-dev
mailing list