a and b are upper half and lower half of the same number. Now I have to save this number to a 64 bit register. lets say a = -1(Higher bytes) and b = -50. How can I do this ?
I am using the following which works for positive numbers.
int64_t c = (a);
c = (c<<32);
c+=b;
The above does not work for -ve numbers. How to do this ?
Edit: The above code for -ve numbers give a very large value for the -50. Basically what this means is that after the operation the "c" should have the value of -50, but it should be 64 bits. As upper half i.e. "a" is -1 and acts as the signed bit. The lower half has a -ve sign which makes it value very large due to the shifting operation. I hope this is a little more clear.
cbe the integer whose (two's complement) binary representation is the concatenation of the binary representations ofaandb(both extended to be 32 binary digits long)?