Data is received in an array of 1 byte elements. The code to put two bytes into rptrTemp16 works fine. Is there a better way to do this?
The real issue is next - I read it into a 16 bit int first because if it's shifted into a long int, the high bit indicating a 2's complement negative number will no longer be the high bit.
I need to ultimately get it to a long int for some further math, but I'm not sure how a 2's complement, negative number is handled, and where and if the conversion to a negative number takes place.
Help is really appreciated. Thanks in advance.
int rptrTemp16;
long int rptrTemp32;
rptrTemp16 = nrf_buf[4];
rptrTemp16 = rptrTemp16 << 8;
rptrTemp16 |= nrf_buf[3];
rptrTemp32 = rptrTemp16 //