posted 19 years ago
If you know that i and j are int (i.e., can be represented in 32 bits), something like the following would do the trick.
long i = 5;
int j = 7;
i = (i << 32) + j;
j = i >> 32;
i = i & 1111111111111111;
I haven't tested it, and it doesn't work with negative numbers, but you get the idea.
Of course, you can just use simple arithmetic:
i = i + j;
j = i - j;
i = i - j;