Created
November 21, 2019 07:32
-
-
Save chichur/77caeaeccfcb3bcb08b9c927606f8522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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