I seem to be having a brain fart today as my mind is just blank. I'm parsing datagrams to extract some data. I have an x,y coordinate pair in 8 bytes. My ICD tells me:
bytes 1-4 are the X position
bytes 5-8 are the Y position
The 64th bit of the X position is the sign bit, so it's in 2's complement. The 32nd bit is the sign bit for the Y position.
So to decode the X coordinate, do I reverse the top four bytes:
ABCD ==> DCBA
And then the sign bit is the 8th bit of the first byte (A)?
*whacks head against wall*
bytes 1-4 are the X position
bytes 5-8 are the Y position
The 64th bit of the X position is the sign bit, so it's in 2's complement. The 32nd bit is the sign bit for the Y position.
So to decode the X coordinate, do I reverse the top four bytes:
ABCD ==> DCBA
And then the sign bit is the 8th bit of the first byte (A)?
*whacks head against wall*