File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ ArduinoJson: change log
4
4
HEAD
5
5
----
6
6
7
+ * Fixed warning "unused variable" with GCC 4.4 (issue #912 )
7
8
* Added a clear error message for ` StaticJsonBuffer ` and ` DynamicJsonBuffer `
8
9
9
10
v6.9.0 (2019-02-26)
Original file line number Diff line number Diff line change @@ -98,12 +98,8 @@ struct FloatTraits<T, 8 /*64bits*/> {
98
98
// we use this function to workaround platforms with single precision literals
99
99
// (for example, when -fsingle-precision-constant is passed to GCC)
100
100
static T forge (uint32_t msb, uint32_t lsb) {
101
- union {
102
- uint64_t integerBits;
103
- T floatBits;
104
- };
105
- integerBits = (uint64_t (msb) << 32 ) | lsb;
106
- return floatBits;
101
+ uint64_t bits = (uint64_t (msb) << 32 ) | lsb;
102
+ return *reinterpret_cast <T*>(&bits);
107
103
}
108
104
};
109
105
@@ -150,12 +146,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
150
146
}
151
147
152
148
static T forge (uint32_t bits) {
153
- union {
154
- uint32_t integerBits;
155
- T floatBits;
156
- };
157
- integerBits = bits;
158
- return floatBits;
149
+ return *reinterpret_cast <T*>(&bits);
159
150
}
160
151
161
152
static T nan () {
You can’t perform that action at this time.
0 commit comments