Update dptconvert.cpp

This commit is contained in:
Maggyver 2019-07-13 10:45:57 +02:00 committed by GitHub
parent 575d95c2e6
commit 7a696cc29a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1809,7 +1809,7 @@ void float16ToPayload(uint8_t* payload, int payload_length, int index, double va
int exponent = 0;
for (; v < -2048.0f; v /= 2) exponent++;
for (; v > 2047.0f; v /= 2) exponent++;
long m = round(v) & 0x7FF;
short m = roundf(v) & 0x7FF;
short msb = (short) (exponent << 3 | m >> 8);
if (value < 0.0f) msb |= 0x80;