я же сделал по другому немного но на Си:
float real48_to_float(unsigned char* real48_data) {
unsigned char bytes[6];
float result;
int i;
/* Copy the 6 bytes of the real48 data into a local array */
for (i = 0; i < 6; i++) {
bytes[i] = real48_data[i];
}
/* Convert the real48 data to a float */
bytes[5] &= 0x7F;
result = (float)((bytes[0] << 8) | bytes[1]);
result += (float)((bytes[2] << 8) | bytes[3]) / 65536.0;
result += (float)((bytes[4] << 8) | bytes[5]) / 4294967296.0;
if (real48_data[5] & 0x80) {
result = -result;
}
return result;
}
Веткая же сделал по другому немного но на Си:
2 сообщения · –T