PRI combine_unsigned(MSB, LSB) result.byte[0] := LSB result.byte[1] := MSB PRI combine_signed(MSB, LSB) result.byte[0] := LSB result.byte[1] := MSB return ~~result ' sign-extend word to long
yousef wrote: » How to remove the last two bits(LSB) to make it 14 bits number?
result := result ~> 2
Comments
PRI combine_unsigned(MSB, LSB) result.byte[0] := LSB result.byte[1] := MSB PRI combine_signed(MSB, LSB) result.byte[0] := LSB result.byte[1] := MSB return ~~result ' sign-extend word to long
If the value is signed:
result := result ~> 2
This removes two LSB bits from the value while preserving the sign.