You need to sign in before continuing.
Commit f5e0585b86527666558349ca279f6555127447aa
1 parent
f9263110
Removed useless init in float conversions
Showing
1 changed file
with
2 additions
and
2 deletions
src/modbus-data.c
| ... | ... | @@ -76,7 +76,7 @@ uint8_t modbus_get_byte_from_bits(const uint8_t *src, int index, |
| 76 | 76 | /* Get a float from 4 bytes in Modbus format */ |
| 77 | 77 | float modbus_get_float(const uint16_t *src) |
| 78 | 78 | { |
| 79 | - float f = 0.0f; | |
| 79 | + float f; | |
| 80 | 80 | uint32_t i; |
| 81 | 81 | |
| 82 | 82 | i = (((uint32_t)src[1]) << 16) + src[0]; |
| ... | ... | @@ -88,7 +88,7 @@ float modbus_get_float(const uint16_t *src) |
| 88 | 88 | /* Set a float to 4 bytes in Modbus format */ |
| 89 | 89 | void modbus_set_float(float f, uint16_t *dest) |
| 90 | 90 | { |
| 91 | - uint32_t i = 0; | |
| 91 | + uint32_t i; | |
| 92 | 92 | |
| 93 | 93 | memcpy(&i, &f, sizeof(uint32_t)); |
| 94 | 94 | dest[0] = (uint16_t)i; | ... | ... |