You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
243 B

int16_t decode(uint8_t t)
{
int16_t exp = 0x8 - (0x7 & (t >> 4));
uint16_t base = (0x1 << (exp+ 5)) - 34;
int16_t step = 0x1 << exp;
int16_t ret = base - step * (0xf & t);
ret = -ret - 1 + (2 * ret + 1) * (t >> 7);
return ret;
}