From e9aa47200ea8c0907537483a7a7c5292b6238d6f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 2 Oct 2014 12:43:18 +0200 Subject: [PATCH] fix aliasing error for parsing message float data Signed-off-by: Felix Fietkau --- data/gen-code.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gen-code.pl b/data/gen-code.pl index 5245bde..f45d28a 100755 --- a/data/gen-code.pl +++ b/data/gen-code.pl @@ -19,7 +19,7 @@ my %tlv_get = ( 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))", - gfloat => "({ uint32_t data = le32_to_cpu(*(uint32_t *) get_next(4)); *((float *) &data); })" + gfloat => "({ uint32_t data = le32_to_cpu(*(uint32_t *) get_next(4)); float _val; memcpy(&_val, &data, sizeof(_val)); _val; })" ); my %tlv_get_be = ( -- 2.25.1