From the library I'm working with, I get an ushort
array.
I want to convert them to a float
array: the first ushort
represents 16 MSB of the first float
, and the second ushort
is 16 LSB of the first float
, and therefore on.
I tried to do something like the following, but the value is passed as an integer, not the raw bits:
ushort[] buffer = { 0xBF80, 0x0000 }; float f = (uint)buffer[0] << 16 | buffer[1];
Any suggestion?
source share