I am doing some work in embedded C with an accelerometer that returns data as a 14 bit 2\'s complement number. I am storing this result directly into a uint16_t
uint16_t
To convert the 14-bit two's-complement into a signed value, you can flip the sign bit and subtract the offset:
int16_t raw_signed = (raw ^ 1 << 13) - (1 << 13);