My class wraps an object of type Vector3D, which consists of three double typed fields x, y and z. I'd like to create a hash based on those values but since double is 64 bit and int only 32, I'd need to "break" each coordinate in half and impose the first half on the second.
If we pretend that our variable is 4 bit wide and the input is 8 bit wide, I'd like to do the following.
x = 10010101
y = 01010111
z = 11110010x1 = 1001
x2 = 0101
y1 = 0101
y2 = 0111
z1 = 1111
z0 = 0010
So that the resulting hash of width 4 bits would be, e.g. XOR on the above. Not sure how to perform the appropriate bitwise operations on double so that it ends up in my int. Googling gave me only the docs and those didn't make me any wiser.
Still, I feel that this is a standard issue and that the solution should be easy to find, if using the right keywords. Any help?