Skip to content

Instantly share code, notes, and snippets.

View chichur's full-sized avatar
🏒
Focusing

chichur

🏒
Focusing
  • Gazprom
  • Saint-Peterburg
View GitHub Profile
#include <time.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#define C55 0x5555555555555555ULL
#define C33 0x3333333333333333ULL
#define C0F 0x0f0f0f0f0f0f0f0fULL
#define C01 0x0101010101010101ULL
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;
}