Skip to content

Instantly share code, notes, and snippets.

@chichur
Created November 21, 2019 07:32
Show Gist options
  • Save chichur/77caeaeccfcb3bcb08b9c927606f8522 to your computer and use it in GitHub Desktop.
Save chichur/77caeaeccfcb3bcb08b9c927606f8522 to your computer and use it in GitHub Desktop.
static float Converter(ushort[] buffer)
{
byte[] bytes = new byte[4];
bytes[0] = (byte)(buffer[1] & 0xFF);
bytes[1] = (byte)(buffer[1] >> 8);
bytes[2] = (byte)(buffer[0] & 0xFF);
bytes[3] = (byte)(buffer[0] >> 8);
float value = BitConverter.ToSingle(bytes, 0);
return value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment