Convert Raw 14 bit Two's Complement to Signed 16 bit Integer
问题 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 . Later in my code I am trying to convert this "raw" form of the data into a signed integer to represent / work with in the rest of my code. I am having trouble getting the compiler to understand what I am trying to do. In the following code I'm checking if the 14th bit is set (meaning the number is negative) and then I want to invert