I found these conversions from uint16_t
to int32_t
here https://gist.github.com/mux2000/5a0db5be900ca8b7f2d528fb37968b38.
int32_t ac6 = (int32_t)(int16_t)bmp180_cal_data[AC6],
ac5 = (int32_t)(int16_t)bmp180_cal_data[AC5],
mc = (int32_t)(int16_t)bmp180_cal_data[MC],
md = (int32_t)(int16_t)bmp180_cal_data[MD];
<代码>bmp180_cal_data is a range of uint16_t
。 因此,在从不同大小的未签名和副手转换时,首先应投向原始价值的大小(bmp180_cal_data[x]
,然后投向新的尺寸。
这是否正确? 如果是,为什么?